hgeometry-ipe: Reading and Writing ipe7 files.

[ bsd3, geometry, library ] [ Propose Tags ]
Versions [RSS] 0.9.0.0, 0.10.0.0, 0.11.0.0, 0.12.0.0, 0.13
Dependencies aeson (>=1.0), base (>=4.11 && <5), bifunctors (>=4.1), bytestring (>=0.10), colour (>=2.3.3), containers (>=0.5.5), data-clist (>=0.0.7.2), deepseq (>=1.1), dlist (>=0.7), fingertree (>=0.1), fixed-vector (>=1.0), hexpat (>=0.20.9), hgeometry (>=0.12.0.0), hgeometry-combinatorial (>=0.12.0.0), lens (>=4.2), linear (>=1.10), MonadRandom (>=0.5), mtl, parsec (>=3), QuickCheck (>=2.5), quickcheck-instances (>=0.3), random, reflection (>=2.1), semigroupoids (>=5), semigroups (>=0.18), singletons (>=2 && <4), singletons-th (>=3 && <4), template-haskell, text (>=1.1.1.0), vector (>=0.11), vinyl (>=0.10), yaml (>=0.8) [details]
License BSD-3-Clause
Author Frank Staals
Maintainer frank@fstaals.net
Category Geometry
Home page https://fstaals.net/software/hgeometry
Source repo head: git clone https://github.com/noinia/hgeometry
Uploaded by FrankStaals at 2021-06-07T17:13:31Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 3105 total (23 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-06-07 [all 1 reports]

Readme for hgeometry-ipe-0.12.0.0

[back to package description]

HGeometry-ipe

This package provides an API for reading and writing Ipe (http://ipe.otfried.org) files. This is all very work in progress. Hence, the API is experimental and may change at any time!

Here is an example showing reading a set of points from an Ipe file, computing the DelaunayTriangulation, and writing the result again to an output file

mainWith                          :: Options -> IO ()
mainWith (Options inFile outFile) = do
    ePage <- readSinglePageFile inFile
    case ePage of
      Left err                         -> print err
      Right (page :: IpePage Rational) -> case page^..content.traverse._IpeUse of
        []         -> putStrLn "No points found"
        syms@(_:_) -> do
           let pts  = syms&traverse.core %~ (^.symbolPoint)
               pts' = NonEmpty.fromList pts
               dt   = delaunayTriangulation $ pts'
               out  = [iO $ drawTriangulation dt]
           writeIpeFile outFile . singlePageFromContent $ out

See the hgeometry-examples package for more examples.