Safe Haskell | None |
---|---|
Language | Haskell98 |
Set operations on paths. As a side effect it removes overlapping
regions. Since Path
is TrailLike
, you can use these operations
directly on most diagrams combinators which generate Loop
s, like
circle
or fromSegments
. Line
s are discarded, only Loop
s
are used. If you have several paths, you can combine them first
with <>
. Use toPath
if you want to convert a Trail
or
`Located Trail` to a Path
. The FillRule
argument determines
how insideness is calculated.
- union :: FillRule -> Path V2 Double -> Path V2 Double
- difference :: FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double
- intersection :: FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double
- exclusion :: FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double
- union' :: Double -> FillRule -> Path V2 Double -> Path V2 Double
- difference' :: Double -> FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double
- intersection' :: Double -> FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double
- exclusion' :: Double -> FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double
- loopUnion :: Double -> FillRule -> [Located (Trail' Loop V2 Double)] -> [Located (Trail' Loop V2 Double)]
- loopDifference :: Double -> FillRule -> [Located (Trail' Loop V2 Double)] -> [Located (Trail' Loop V2 Double)] -> [Located (Trail' Loop V2 Double)]
- loopIntersection :: Double -> FillRule -> [Located (Trail' Loop V2 Double)] -> [Located (Trail' Loop V2 Double)] -> [Located (Trail' Loop V2 Double)]
- loopExclusion :: Double -> FillRule -> [Located (Trail' Loop V2 Double)] -> [Located (Trail' Loop V2 Double)] -> [Located (Trail' Loop V2 Double)]
operations on Paths
union :: FillRule -> Path V2 Double -> Path V2 Double Source #
Remove overlapping regions in the path. If you have several
paths, combine them using <>
first.
example = strokePath $ union Winding $ (square 1) <> circle 0.5 # translate (V2 0.5 (-0.5))
difference :: FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double Source #
Difference of two paths. First overlap is removed in the two input arguments, then the difference is calculated.
example = strokePath $ difference Winding (square 1) $ circle 0.5 # translate (V2 0.5 (-0.5))
intersection :: FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double Source #
Intersection of two paths. First overlap is removed in the two input arguments, then the intersection is calculated.
example = strokePath $ intersection Winding (square 1) $ circle 0.5 # translate (V2 0.5 (-0.5))
exclusion :: FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double Source #
Exclusion (exclusive or) of two paths. First overlap is removed in the two input arguments, then the exclusion is calculated.
example = fc grey $ strokePath $ exclusion Winding (square 1) $ circle 0.5 # translate (V2 0.5 (-0.5))
operations on Paths with tolerance
union' :: Double -> FillRule -> Path V2 Double -> Path V2 Double Source #
Like union
, but takes a tolerance parameter.
difference' :: Double -> FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double Source #
Like difference
, but takes a tolerance parameter.
intersection' :: Double -> FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double Source #
Like intersection
, but takes a tolerance parameter.
exclusion' :: Double -> FillRule -> Path V2 Double -> Path V2 Double -> Path V2 Double Source #
Like exclusion
, but takes a tolerance parameter.
operations on Loops
loopUnion :: Double -> FillRule -> [Located (Trail' Loop V2 Double)] -> [Located (Trail' Loop V2 Double)] Source #
Union of a list of loops.
loopDifference :: Double -> FillRule -> [Located (Trail' Loop V2 Double)] -> [Located (Trail' Loop V2 Double)] -> [Located (Trail' Loop V2 Double)] Source #
Difference between loops. The loops in both lists are first merged using union
.