@hackage hgeometry-ipe0.9.0.0
Reading and Writing ipe7 files.
Categories
License
BSD-3-Clause
Maintainer
frank@fstaals.net
Links
Versions
Installation
Tested Compilers
Dependencies (31)
- MonadRandom >=0.5
- QuickCheck >=2.5
- aeson >=1.0
- base >=4.11 && <5
- bifunctors >=4.1
- bytestring >=0.10 Show all…
Dependents (1)
@hackage/hgeometry-svg
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.