diagrams-contrib 1.4.3 → 1.4.4
raw patch · 8 files changed
+303/−9 lines, 8 filesdep ~MonadRandomdep ~QuickCheckdep ~basebinary-addedPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: MonadRandom, QuickCheck, base, diagrams-core, hashable, lens, linear, monoid-extras, random, semigroups, text
API changes (from Hackage documentation)
- Diagrams.Anchors: instance (Linear.Vector.Additive (Diagrams.Core.V.V t), GHC.Num.Num (Diagrams.Core.V.N t), Diagrams.Core.HasOrigin.HasOrigin t, Data.Semigroup.Semigroup t) => Data.Semigroup.Semigroup (Diagrams.Anchors.Anchored t)
- Diagrams.TwoD.Layout.Tree: instance Data.Semigroup.Semigroup (Diagrams.TwoD.Layout.Tree.Extent n)
- Diagrams.TwoD.Path.Follow: instance (GHC.Classes.Ord n, GHC.Float.Floating n) => Data.Semigroup.Semigroup (Diagrams.TwoD.Path.Follow.Following n)
- Diagrams.TwoD.Path.Follow: instance (GHC.Classes.Ord n, GHC.Float.Floating n) => GHC.Base.Monoid (Diagrams.TwoD.Path.Follow.Following n)
- Diagrams.TwoD.Path.Metafont.Types: instance (GHC.Show.Show d, GHC.Show.Show j, GHC.Show.Show n) => GHC.Show.Show (Diagrams.TwoD.Path.Metafont.Types.MetafontSegment d j n)
- Diagrams.TwoD.Path.Metafont.Types: instance (GHC.Show.Show j, GHC.Show.Show d) => GHC.Show.Show (Diagrams.TwoD.Path.Metafont.Types.PathJoin d j)
- Diagrams.TwoD.Path.Metafont.Types: instance (GHC.Show.Show n, GHC.Show.Show j, GHC.Show.Show d) => GHC.Show.Show (Diagrams.TwoD.Path.Metafont.Types.MFPath d j n)
- Diagrams.TwoD.Path.Metafont.Types: instance Data.Semigroup.Semigroup (Diagrams.TwoD.Path.Metafont.Types.PathJoin (GHC.Base.Maybe (Diagrams.TwoD.Path.Metafont.Types.PathDir n)) (GHC.Base.Maybe (Diagrams.TwoD.Path.Metafont.Types.BasicJoin n)))
- Diagrams.TwoD.Path.Metafont.Types: instance GHC.Base.Monoid (Diagrams.TwoD.Path.Metafont.Types.PathJoin (GHC.Base.Maybe (Diagrams.TwoD.Path.Metafont.Types.PathDir n)) (GHC.Base.Maybe (Diagrams.TwoD.Path.Metafont.Types.BasicJoin n)))
+ Diagrams.Anchors: instance (Linear.Vector.Additive (Diagrams.Core.V.V t), GHC.Num.Num (Diagrams.Core.V.N t), Diagrams.Core.HasOrigin.HasOrigin t, GHC.Base.Semigroup t) => GHC.Base.Semigroup (Diagrams.Anchors.Anchored t)
+ Diagrams.TwoD.Layout.Tree: instance GHC.Base.Semigroup (Diagrams.TwoD.Layout.Tree.Extent n)
+ Diagrams.TwoD.Path.Follow: instance (GHC.Float.Floating n, GHC.Classes.Ord n) => GHC.Base.Monoid (Diagrams.TwoD.Path.Follow.Following n)
+ Diagrams.TwoD.Path.Follow: instance (GHC.Float.Floating n, GHC.Classes.Ord n) => GHC.Base.Semigroup (Diagrams.TwoD.Path.Follow.Following n)
+ Diagrams.TwoD.Path.IntersectionExtras: class OnSections ps fs b n | ps b -> fs n, fs -> b n
+ Diagrams.TwoD.Path.IntersectionExtras: cutBy :: (OrderedField n, Real n, InSpace V2 n t, SameSpace t s, ToPath t, ToPath s) => t -> s -> [[Located (Trail V2 n)]]
+ Diagrams.TwoD.Path.IntersectionExtras: cutBy' :: (OrderedField n, Real n, InSpace V2 n t, SameSpace t s, ToPath t, ToPath s) => n -> t -> s -> [[Located (Trail V2 n)]]
+ Diagrams.TwoD.Path.IntersectionExtras: cutPBy :: (OrderedField n, Real n) => Path V2 n -> Path V2 n -> [[Located (Trail V2 n)]]
+ Diagrams.TwoD.Path.IntersectionExtras: cutPBy' :: (OrderedField n, Real n) => n -> Path V2 n -> Path V2 n -> [[Located (Trail V2 n)]]
+ Diagrams.TwoD.Path.IntersectionExtras: cutTBy :: (OrderedField n, Real n) => Located (Trail V2 n) -> Path V2 n -> [Located (Trail V2 n)]
+ Diagrams.TwoD.Path.IntersectionExtras: cutTBy' :: (OrderedField n, Real n) => n -> Located (Trail V2 n) -> Path V2 n -> [Located (Trail V2 n)]
+ Diagrams.TwoD.Path.IntersectionExtras: explodeBoth :: (OrderedField n, Real n) => Path V2 n -> [[[Located (Trail V2 n)]]]
+ Diagrams.TwoD.Path.IntersectionExtras: explodeBoth' :: (OrderedField n, Real n) => n -> Path V2 n -> [[[Located (Trail V2 n)]]]
+ Diagrams.TwoD.Path.IntersectionExtras: explodeIntersections :: (OrderedField n, Real n) => Path V2 n -> [[Located (Trail V2 n)]]
+ Diagrams.TwoD.Path.IntersectionExtras: explodeIntersections' :: (OrderedField n, Real n) => n -> Path V2 n -> [[Located (Trail V2 n)]]
+ Diagrams.TwoD.Path.IntersectionExtras: explodeSegments :: (Metric v, OrderedField n) => Path v n -> [[Located (Trail v n)]]
+ Diagrams.TwoD.Path.IntersectionExtras: instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) b) => Diagrams.TwoD.Path.IntersectionExtras.OnSections (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any) (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any -> Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any) b n
+ Diagrams.TwoD.Path.IntersectionExtras: instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) b) => Diagrams.TwoD.Path.IntersectionExtras.OnSections (Diagrams.Located.Located (Diagrams.Segment.Segment Diagrams.Segment.Closed Linear.V2.V2 n)) (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any -> Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any) b n
+ Diagrams.TwoD.Path.IntersectionExtras: instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) b) => Diagrams.TwoD.Path.IntersectionExtras.OnSections (Diagrams.Located.Located (Diagrams.Trail.Trail Linear.V2.V2 n)) (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any -> Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any) b n
+ Diagrams.TwoD.Path.IntersectionExtras: instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) b) => Diagrams.TwoD.Path.IntersectionExtras.OnSections (Diagrams.Located.Located (Diagrams.Trail.Trail' l Linear.V2.V2 n)) (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any -> Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any) b n
+ Diagrams.TwoD.Path.IntersectionExtras: instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) b) => Diagrams.TwoD.Path.IntersectionExtras.OnSections (Diagrams.Located.Located [Diagrams.Segment.Segment Diagrams.Segment.Closed Linear.V2.V2 n]) (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any -> Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any) b n
+ Diagrams.TwoD.Path.IntersectionExtras: instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) b) => Diagrams.TwoD.Path.IntersectionExtras.OnSections (Diagrams.Path.Path Linear.V2.V2 n) (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any -> Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any) b n
+ Diagrams.TwoD.Path.IntersectionExtras: instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) b) => Diagrams.TwoD.Path.IntersectionExtras.OnSections (Diagrams.Segment.FixedSegment Linear.V2.V2 n) (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any -> Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any) b n
+ Diagrams.TwoD.Path.IntersectionExtras: instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) b) => Diagrams.TwoD.Path.IntersectionExtras.OnSections (Diagrams.Trail.Trail Linear.V2.V2 n) (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any -> Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any) b n
+ Diagrams.TwoD.Path.IntersectionExtras: instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) b) => Diagrams.TwoD.Path.IntersectionExtras.OnSections (Diagrams.Trail.Trail' l Linear.V2.V2 n) (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any -> Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any) b n
+ Diagrams.TwoD.Path.IntersectionExtras: instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.TwoD.Path.IntersectionExtras.OnSections ps fs b n) => Diagrams.TwoD.Path.IntersectionExtras.OnSections [ps] [fs] b n
+ Diagrams.TwoD.Path.IntersectionExtras: intersectParams :: (InSpace V2 n t, SameSpace t s, ToPath t, ToPath s, OrderedField n) => t -> s -> ([[n]], [[n]])
+ Diagrams.TwoD.Path.IntersectionExtras: intersectParams' :: (InSpace V2 n t, SameSpace t s, ToPath t, ToPath s, OrderedField n) => n -> t -> s -> ([[n]], [[n]])
+ Diagrams.TwoD.Path.IntersectionExtras: intersectParamsP :: OrderedField n => Path V2 n -> Path V2 n -> ([[n]], [[n]])
+ Diagrams.TwoD.Path.IntersectionExtras: intersectParamsP' :: OrderedField n => n -> Path V2 n -> Path V2 n -> ([[n]], [[n]])
+ Diagrams.TwoD.Path.IntersectionExtras: intersectParamsT :: OrderedField n => Located (Trail V2 n) -> Located (Trail V2 n) -> ([n], [n])
+ Diagrams.TwoD.Path.IntersectionExtras: intersectParamsT' :: OrderedField n => n -> Located (Trail V2 n) -> Located (Trail V2 n) -> ([n], [n])
+ Diagrams.TwoD.Path.IntersectionExtras: intersectParamsTS :: OrderedField n => Located (Trail V2 n) -> Located (Trail V2 n) -> ([[n]], [[n]])
+ Diagrams.TwoD.Path.IntersectionExtras: intersectParamsTS' :: OrderedField n => n -> Located (Trail V2 n) -> Located (Trail V2 n) -> ([[n]], [[n]])
+ Diagrams.TwoD.Path.IntersectionExtras: onSections :: OnSections ps fs b n => ps -> fs -> QDiagram b V2 n Any
+ Diagrams.TwoD.Path.Metafont.Types: instance (GHC.Show.Show d, GHC.Show.Show j) => GHC.Show.Show (Diagrams.TwoD.Path.Metafont.Types.PathJoin d j)
+ Diagrams.TwoD.Path.Metafont.Types: instance (GHC.Show.Show n, GHC.Show.Show d, GHC.Show.Show j) => GHC.Show.Show (Diagrams.TwoD.Path.Metafont.Types.MFPath d j n)
+ Diagrams.TwoD.Path.Metafont.Types: instance (GHC.Show.Show n, GHC.Show.Show d, GHC.Show.Show j) => GHC.Show.Show (Diagrams.TwoD.Path.Metafont.Types.MetafontSegment d j n)
+ Diagrams.TwoD.Path.Metafont.Types: instance GHC.Base.Monoid (Diagrams.TwoD.Path.Metafont.Types.PathJoin (GHC.Maybe.Maybe (Diagrams.TwoD.Path.Metafont.Types.PathDir n)) (GHC.Maybe.Maybe (Diagrams.TwoD.Path.Metafont.Types.BasicJoin n)))
+ Diagrams.TwoD.Path.Metafont.Types: instance GHC.Base.Semigroup (Diagrams.TwoD.Path.Metafont.Types.PathJoin (GHC.Maybe.Maybe (Diagrams.TwoD.Path.Metafont.Types.PathDir n)) (GHC.Maybe.Maybe (Diagrams.TwoD.Path.Metafont.Types.BasicJoin n)))
- Diagrams.Anchors: alignAnchor :: (IsName a) => a -> Anchored t -> Anchored t
+ Diagrams.Anchors: alignAnchor :: IsName a => a -> Anchored t -> Anchored t
- Diagrams.Anchors: hasAnchor :: (IsName a) => a -> Anchored t -> Bool
+ Diagrams.Anchors: hasAnchor :: IsName a => a -> Anchored t -> Bool
- Diagrams.Anchors: rotateAnchors :: (IsName anchor) => [anchor] -> Int -> Anchored t -> Anchored t
+ Diagrams.Anchors: rotateAnchors :: IsName anchor => [anchor] -> Int -> Anchored t -> Anchored t
- Diagrams.Example.Logo: a1 :: ((~#) (* -> *) (* -> *) V b V2, Transformable b, Typeable * N b, HasOrigin b, Alignable b, TrailLike b, Juxtaposable b, Semigroup b, HasStyle b) => b
+ Diagrams.Example.Logo: a1 :: (HasStyle b, HasOrigin b, Alignable b, TrailLike b, Juxtaposable b, Semigroup b, Typeable (N b), Transformable b, V b ~# V2) => b
- Diagrams.Example.Logo: a2 :: (Typeable * n, TrailLike QDiagram b V2 n m, Ord n, Floating n, Semigroup m, Monoid m) => QDiagram b V2 n m
+ Diagrams.Example.Logo: a2 :: (Monoid m, Floating n, Ord n, TrailLike (QDiagram b V2 n m), Typeable n) => QDiagram b V2 n m
- Diagrams.Example.Logo: d :: (Typeable * n, RealFloat n, Renderable Path V2 n b) => QDiagram b V2 n Any
+ Diagrams.Example.Logo: d :: (Renderable (Path V2 n) b, RealFloat n, Typeable n) => QDiagram b V2 n Any
- Diagrams.Example.Logo: disk :: ((~#) (* -> *) (* -> *) V b V2, HasStyle b, Typeable * N b, Transformable b, TrailLike b) => Colour Double -> b
+ Diagrams.Example.Logo: disk :: (TrailLike b, Transformable b, Typeable (N b), HasStyle b, V b ~# V2) => Colour Double -> b
- Diagrams.Example.Logo: g :: (Renderable Text n b, Renderable Path V2 n b, RealFloat n, Typeable * n) => QDiagram b V2 n Any
+ Diagrams.Example.Logo: g :: (Typeable n, RealFloat n, Renderable (Path V2 n) b, Renderable (Text n) b) => QDiagram b V2 n Any
- Diagrams.Example.Logo: grid :: ((~#) (* -> *) (* -> *) V a V2, Semigroup a, TrailLike a, Monoid a, HasOrigin a, Juxtaposable a, Alignable a, Transformable a) => a
+ Diagrams.Example.Logo: grid :: (Transformable a, Alignable a, TrailLike a, Monoid a, HasOrigin a, Juxtaposable a, V a ~# V2) => a
- Diagrams.Example.Logo: i :: (Typeable * n, RealFloat n, TrailLike QDiagram b V2 n m, Monoid m, Semigroup m) => QDiagram b V2 n m
+ Diagrams.Example.Logo: i :: (Monoid m, TrailLike (QDiagram b V2 n m), RealFloat n, Typeable n) => QDiagram b V2 n m
- Diagrams.Example.Logo: ico_d :: (Typeable * n, RealFloat n, Renderable Path V2 n b) => QDiagram b V2 n Any
+ Diagrams.Example.Logo: ico_d :: (Renderable (Path V2 n) b, RealFloat n, Typeable n) => QDiagram b V2 n Any
- Diagrams.Example.Logo: logo :: (Typeable * n, RealFloat n, Renderable Text n b, Renderable Path V2 n b) => QDiagram b V2 n Any
+ Diagrams.Example.Logo: logo :: (Renderable (Path V2 n) b, Renderable (Text n) b, Typeable n, RealFloat n) => QDiagram b V2 n Any
- Diagrams.Example.Logo: m :: (Renderable Text n b, Renderable Path V2 n b, RealFloat n, Typeable * n) => QDiagram b V2 n Any
+ Diagrams.Example.Logo: m :: (Typeable n, RealFloat n, Renderable (Path V2 n) b, Renderable (Text n) b) => QDiagram b V2 n Any
- Diagrams.Example.Logo: r :: (Renderable Path V2 n b, RealFloat n, Typeable * n) => QDiagram b V2 n Any
+ Diagrams.Example.Logo: r :: (Typeable n, RealFloat n, Renderable (Path V2 n) b) => QDiagram b V2 n Any
- Diagrams.Example.Logo: s :: ((~#) (* -> *) (* -> *) V b V2, Typeable * N b, Semigroup b, Monoid b, HasOrigin b, HasStyle b, Transformable b, TrailLike b) => b
+ Diagrams.Example.Logo: s :: (HasStyle b, Transformable b, TrailLike b, HasOrigin b, Monoid b, Typeable (N b), V b ~# V2) => b
- Diagrams.Example.Logo: sierpinski :: ((~#) (* -> *) (* -> *) V p V2, Eq t, HasOrigin p, Alignable p, Num t, TrailLike p, Juxtaposable p, Semigroup p) => t -> p
+ Diagrams.Example.Logo: sierpinski :: (Semigroup p, Juxtaposable p, TrailLike p, Num t, Alignable p, HasOrigin p, Eq t, V p ~# V2) => t -> p
- Diagrams.TwoD.Grid: gridLL :: forall n_a1fQI. Lens' (GridOpts n_a1fQI) (V2 n_a1fQI)
+ Diagrams.TwoD.Grid: gridLL :: forall n_aAbX. Lens' (GridOpts n_aAbX) (V2 n_aAbX)
- Diagrams.TwoD.Grid: gridLR :: forall n_a1fQI. Lens' (GridOpts n_a1fQI) (V2 n_a1fQI)
+ Diagrams.TwoD.Grid: gridLR :: forall n_aAbX. Lens' (GridOpts n_aAbX) (V2 n_aAbX)
- Diagrams.TwoD.Grid: gridLineWidth :: forall n_a1fQI. Lens' (GridOpts n_a1fQI) (Measure n_a1fQI)
+ Diagrams.TwoD.Grid: gridLineWidth :: forall n_aAbX. Lens' (GridOpts n_aAbX) (Measure n_aAbX)
- Diagrams.TwoD.Grid: gridUL :: forall n_a1fQI. Lens' (GridOpts n_a1fQI) (V2 n_a1fQI)
+ Diagrams.TwoD.Grid: gridUL :: forall n_aAbX. Lens' (GridOpts n_aAbX) (V2 n_aAbX)
- Diagrams.TwoD.Grid: gridXColour :: forall n_a1fQI. Lens' (GridOpts n_a1fQI) (Colour Double)
+ Diagrams.TwoD.Grid: gridXColour :: forall n_aAbX. Lens' (GridOpts n_aAbX) (Colour Double)
- Diagrams.TwoD.Grid: gridYColour :: forall n_a1fQI. Lens' (GridOpts n_a1fQI) (Colour Double)
+ Diagrams.TwoD.Grid: gridYColour :: forall n_aAbX. Lens' (GridOpts n_aAbX) (Colour Double)
- Diagrams.TwoD.Grid: highLightLineColour :: forall n_a1fQH. Lens' (HighlightLineOpts n_a1fQH) (Colour Double)
+ Diagrams.TwoD.Grid: highLightLineColour :: forall n_aAbW. Lens' (HighlightLineOpts n_aAbW) (Colour Double)
- Diagrams.TwoD.Grid: highLightLineDashingOffset :: forall n_a1fQH. Lens' (HighlightLineOpts n_a1fQH) (Measure n_a1fQH)
+ Diagrams.TwoD.Grid: highLightLineDashingOffset :: forall n_aAbW. Lens' (HighlightLineOpts n_aAbW) (Measure n_aAbW)
- Diagrams.TwoD.Grid: highLightLineDashingOnOff :: forall n_a1fQH. Lens' (HighlightLineOpts n_a1fQH) [Measure n_a1fQH]
+ Diagrams.TwoD.Grid: highLightLineDashingOnOff :: forall n_aAbW. Lens' (HighlightLineOpts n_aAbW) [Measure n_aAbW]
- Diagrams.TwoD.Grid: highLightLineWidth :: forall n_a1fQH. Lens' (HighlightLineOpts n_a1fQH) (Measure n_a1fQH)
+ Diagrams.TwoD.Grid: highLightLineWidth :: forall n_aAbW. Lens' (HighlightLineOpts n_aAbW) (Measure n_aAbW)
- Diagrams.TwoD.Layout.Tree: BNode :: a -> (BTree a) -> (BTree a) -> BTree a
+ Diagrams.TwoD.Layout.Tree: BNode :: a -> BTree a -> BTree a -> BTree a
- Diagrams.TwoD.Layout.Tree: edgeLen :: forall n_a1viG. Lens' (ForceLayoutTreeOpts n_a1viG) n_a1viG
+ Diagrams.TwoD.Layout.Tree: edgeLen :: forall n_aNDe. Lens' (ForceLayoutTreeOpts n_aNDe) n_aNDe
- Diagrams.TwoD.Layout.Tree: forceLayoutOpts :: forall n_a1viG. Lens' (ForceLayoutTreeOpts n_a1viG) (ForceLayoutOpts n_a1viG)
+ Diagrams.TwoD.Layout.Tree: forceLayoutOpts :: forall n_aNDe. Lens' (ForceLayoutTreeOpts n_aNDe) (ForceLayoutOpts n_aNDe)
- Diagrams.TwoD.Layout.Tree: label :: (Traversable t) => t a -> t (a, PID)
+ Diagrams.TwoD.Layout.Tree: label :: Traversable t => t a -> t (a, PID)
- Diagrams.TwoD.Layout.Tree: slHSep :: forall n_a1uyA a_a1uyB. Lens' (SymmLayoutOpts n_a1uyA a_a1uyB) n_a1uyA
+ Diagrams.TwoD.Layout.Tree: slHSep :: forall n_aMPf a_aMPg. Lens' (SymmLayoutOpts n_aMPf a_aMPg) n_aMPf
- Diagrams.TwoD.Layout.Tree: slHeight :: forall n_a1uyA a_a1uyB. Lens' (SymmLayoutOpts n_a1uyA a_a1uyB) (a_a1uyB -> (n_a1uyA, n_a1uyA))
+ Diagrams.TwoD.Layout.Tree: slHeight :: forall n_aMPf a_aMPg. Lens' (SymmLayoutOpts n_aMPf a_aMPg) (a_aMPg -> (n_aMPf, n_aMPf))
- Diagrams.TwoD.Layout.Tree: slVSep :: forall n_a1uyA a_a1uyB. Lens' (SymmLayoutOpts n_a1uyA a_a1uyB) n_a1uyA
+ Diagrams.TwoD.Layout.Tree: slVSep :: forall n_aMPf a_aMPg. Lens' (SymmLayoutOpts n_aMPf a_aMPg) n_aMPf
- Diagrams.TwoD.Layout.Tree: slWidth :: forall n_a1uyA a_a1uyB. Lens' (SymmLayoutOpts n_a1uyA a_a1uyB) (a_a1uyB -> (n_a1uyA, n_a1uyA))
+ Diagrams.TwoD.Layout.Tree: slWidth :: forall n_aMPf a_aMPg. Lens' (SymmLayoutOpts n_aMPf a_aMPg) (a_aMPg -> (n_aMPf, n_aMPf))
- Diagrams.TwoD.Layout.Tree: springK :: forall n_a1viG. Lens' (ForceLayoutTreeOpts n_a1viG) n_a1viG
+ Diagrams.TwoD.Layout.Tree: springK :: forall n_aNDe. Lens' (ForceLayoutTreeOpts n_aNDe) n_aNDe
- Diagrams.TwoD.Layout.Tree: staticK :: forall n_a1viG. Lens' (ForceLayoutTreeOpts n_a1viG) n_a1viG
+ Diagrams.TwoD.Layout.Tree: staticK :: forall n_aNDe. Lens' (ForceLayoutTreeOpts n_aNDe) n_aNDe
- Diagrams.TwoD.Path.IteratedSubset: GS :: (V2 n) -> Bool -> Bool -> GeneratorSegment n
+ Diagrams.TwoD.Path.IteratedSubset: GS :: V2 n -> Bool -> Bool -> GeneratorSegment n
- Diagrams.TwoD.Path.Metafont.Types: MFS :: P2 n -> (PathJoin d j) -> P2 n -> MetafontSegment d j n
+ Diagrams.TwoD.Path.Metafont.Types: MFS :: P2 n -> PathJoin d j -> P2 n -> MetafontSegment d j n
- Diagrams.TwoD.Path.Metafont.Types: PathDirDir :: (Dir n) -> PathDir n
+ Diagrams.TwoD.Path.Metafont.Types: PathDirDir :: Dir n -> PathDir n
- Diagrams.TwoD.Path.Metafont.Types: [_pj] :: MetafontSegment d j n -> (PathJoin d j)
+ Diagrams.TwoD.Path.Metafont.Types: [_pj] :: MetafontSegment d j n -> PathJoin d j
- Diagrams.TwoD.Path.Metafont.Types: c1 :: forall n_a1Kg8. Lens' (ControlJoin n_a1Kg8) (P2 n_a1Kg8)
+ Diagrams.TwoD.Path.Metafont.Types: c1 :: forall n_aWz0. Lens' (ControlJoin n_aWz0) (P2 n_aWz0)
- Diagrams.TwoD.Path.Metafont.Types: c2 :: forall n_a1Kg8. Lens' (ControlJoin n_a1Kg8) (P2 n_a1Kg8)
+ Diagrams.TwoD.Path.Metafont.Types: c2 :: forall n_aWz0. Lens' (ControlJoin n_aWz0) (P2 n_aWz0)
- Diagrams.TwoD.Path.Metafont.Types: d1 :: forall d_a1Kbs j_a1Kbt. Lens' (PathJoin d_a1Kbs j_a1Kbt) d_a1Kbs
+ Diagrams.TwoD.Path.Metafont.Types: d1 :: forall d_aWui j_aWuj. Lens' (PathJoin d_aWui j_aWuj) d_aWui
- Diagrams.TwoD.Path.Metafont.Types: d2 :: forall d_a1Kbs j_a1Kbt. Lens' (PathJoin d_a1Kbs j_a1Kbt) d_a1Kbs
+ Diagrams.TwoD.Path.Metafont.Types: d2 :: forall d_aWui j_aWuj. Lens' (PathJoin d_aWui j_aWuj) d_aWui
- Diagrams.TwoD.Path.Metafont.Types: j :: forall d_a1Kbs j_a1Kbt j_a1Kfw. Lens (PathJoin d_a1Kbs j_a1Kbt) (PathJoin d_a1Kbs j_a1Kfw) j_a1Kbt j_a1Kfw
+ Diagrams.TwoD.Path.Metafont.Types: j :: forall d_aWui j_aWuj j_aWyo. Lens (PathJoin d_aWui j_aWuj) (PathJoin d_aWui j_aWyo) j_aWuj j_aWyo
- Diagrams.TwoD.Path.Metafont.Types: loop :: forall d_a1Kr7 j_a1Kr8 n_a1Kr9. Lens' (MFPath d_a1Kr7 j_a1Kr8 n_a1Kr9) Bool
+ Diagrams.TwoD.Path.Metafont.Types: loop :: forall d_aWKp j_aWKq n_aWKr. Lens' (MFPath d_aWKp j_aWKq n_aWKr) Bool
- Diagrams.TwoD.Path.Metafont.Types: pj :: forall d_a1Kra j_a1Krb n_a1Krc d_a1KAR j_a1KAS. Lens (MetafontSegment d_a1Kra j_a1Krb n_a1Krc) (MetafontSegment d_a1KAR j_a1KAS n_a1Krc) (PathJoin d_a1Kra j_a1Krb) (PathJoin d_a1KAR j_a1KAS)
+ Diagrams.TwoD.Path.Metafont.Types: pj :: forall d_aWKs j_aWKt n_aWKu d_aWUl j_aWUm. Lens (MetafontSegment d_aWKs j_aWKt n_aWKu) (MetafontSegment d_aWUl j_aWUm n_aWKu) (PathJoin d_aWKs j_aWKt) (PathJoin d_aWUl j_aWUm)
- Diagrams.TwoD.Path.Metafont.Types: segs :: forall d_a1Kr7 j_a1Kr8 n_a1Kr9 d_a1KD4 j_a1KD5 n_a1KD6. Lens (MFPath d_a1Kr7 j_a1Kr8 n_a1Kr9) (MFPath d_a1KD4 j_a1KD5 n_a1KD6) [MetafontSegment d_a1Kr7 j_a1Kr8 n_a1Kr9] [MetafontSegment d_a1KD4 j_a1KD5 n_a1KD6]
+ Diagrams.TwoD.Path.Metafont.Types: segs :: forall d_aWKp j_aWKq n_aWKr d_aWWN j_aWWO n_aWWP. Lens (MFPath d_aWKp j_aWKq n_aWKr) (MFPath d_aWWN j_aWWO n_aWWP) [MetafontSegment d_aWKp j_aWKq n_aWKr] [MetafontSegment d_aWWN j_aWWO n_aWWP]
- Diagrams.TwoD.Path.Metafont.Types: t1 :: forall n_a1Kg9. Lens' (TensionJoin n_a1Kg9) (Tension n_a1Kg9)
+ Diagrams.TwoD.Path.Metafont.Types: t1 :: forall n_aWz1. Lens' (TensionJoin n_aWz1) (Tension n_aWz1)
- Diagrams.TwoD.Path.Metafont.Types: t2 :: forall n_a1Kg9. Lens' (TensionJoin n_a1Kg9) (Tension n_a1Kg9)
+ Diagrams.TwoD.Path.Metafont.Types: t2 :: forall n_aWz1. Lens' (TensionJoin n_aWz1) (Tension n_aWz1)
- Diagrams.TwoD.Path.Metafont.Types: x1 :: forall d_a1Kra j_a1Krb n_a1Krc. Lens' (MetafontSegment d_a1Kra j_a1Krb n_a1Krc) (P2 n_a1Krc)
+ Diagrams.TwoD.Path.Metafont.Types: x1 :: forall d_aWKs j_aWKt n_aWKu. Lens' (MetafontSegment d_aWKs j_aWKt n_aWKu) (P2 n_aWKu)
- Diagrams.TwoD.Path.Metafont.Types: x2 :: forall d_a1Kra j_a1Krb n_a1Krc. Lens' (MetafontSegment d_a1Kra j_a1Krb n_a1Krc) (P2 n_a1Krc)
+ Diagrams.TwoD.Path.Metafont.Types: x2 :: forall d_aWKs j_aWKt n_aWKu. Lens' (MetafontSegment d_aWKs j_aWKt n_aWKu) (P2 n_aWKu)
- Diagrams.TwoD.Sunburst: colors :: forall n_a2gp5. Lens' (SunburstOpts n_a2gp5) [Colour Double]
+ Diagrams.TwoD.Sunburst: colors :: forall n_a1cca. Lens' (SunburstOpts n_a1cca) [Colour Double]
- Diagrams.TwoD.Sunburst: radius :: forall n_a2gp5. Lens' (SunburstOpts n_a2gp5) n_a2gp5
+ Diagrams.TwoD.Sunburst: radius :: forall n_a1cca. Lens' (SunburstOpts n_a1cca) n_a1cca
- Diagrams.TwoD.Sunburst: sectionWidth :: forall n_a2gp5. Lens' (SunburstOpts n_a2gp5) n_a2gp5
+ Diagrams.TwoD.Sunburst: sectionWidth :: forall n_a1cca. Lens' (SunburstOpts n_a1cca) n_a1cca
Files
- CHANGES.markdown +6/−0
- CONTRIBUTORS +1/−0
- diagrams-contrib.cabal +10/−9
- diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_cutByEx.svg binary
- diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_explodeBothEx.svg binary
- diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_explodeIntersectionsEx.svg binary
- diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_explodeSegmentsEx.svg binary
- src/Diagrams/TwoD/Path/IntersectionExtras.hs +286/−0
CHANGES.markdown view
@@ -1,3 +1,9 @@+1.4.4 (12 Nov 2019)+-------------------++- Updated to build on GHC 8.8+- New module `Diagrams.TwoD.Path.IntersectionExtras`+ 1.4.3 (14 May 2018) -------------------
CONTRIBUTORS view
@@ -9,3 +9,4 @@ Dominic Steinitz <dominic@steinitz.org> Ryan Yates <ryates@cs.rochester.edu> Brent Yorgey <byorgey@gmail.com>+Mike Zuser <mikezuser@gmail.com>
diagrams-contrib.cabal view
@@ -1,5 +1,5 @@ name: diagrams-contrib-version: 1.4.3+version: 1.4.4 synopsis: Collection of user contributions to diagrams EDSL description: A collection of user contributions for diagrams, an embedded domain-specific language for generation@@ -15,7 +15,7 @@ cabal-version: 1.18 extra-source-files: README.markdown, CHANGES.markdown, diagrams/*.svg, CONTRIBUTORS extra-doc-files: diagrams/*.svg-tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.2+tested-with: GHC ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.3 || ==8.6.5 || ==8.8.1 Source-repository head type: git location: http://github.com/diagrams/diagrams-contrib.git@@ -40,6 +40,7 @@ Diagrams.TwoD.Path.Boolean, Diagrams.TwoD.Path.Calligraphic, Diagrams.TwoD.Path.Follow,+ Diagrams.TwoD.Path.IntersectionExtras Diagrams.TwoD.Path.IteratedSubset, Diagrams.TwoD.Path.LSystem, Diagrams.TwoD.Path.Turtle,@@ -50,10 +51,10 @@ Diagrams.TwoD.Path.Metafont.Internal Diagrams.TwoD.Path.Metafont.Combinators Diagrams.TwoD.Path.Metafont.Parser- build-depends: base >= 4.2 && < 4.12,+ build-depends: base >= 4.8 && < 4.14, mtl >= 2.0 && < 2.3, mtl-compat >= 0.2.1 && < 0.3,- containers > 0.4 && < 0.6,+ containers > 0.4 && < 0.7, split >= 0.2.1 && < 0.3, colour >= 2.3.1 && < 2.4, split >= 0.2.1 && < 0.3,@@ -61,7 +62,7 @@ diagrams-core >= 1.4 && < 1.5, diagrams-lib >= 1.4 && < 1.5, diagrams-solve >= 0.1 && < 0.2,- lens >= 4.0 && < 4.17,+ lens >= 4.0 && < 4.19, linear >= 1.11.3 && < 1.21, force-layout >= 0.4 && < 0.5, data-default >= 0.5.2 && < 0.8,@@ -71,9 +72,9 @@ parsec >= 3.1 && < 3.2, text >= 0.11 && < 1.3, data-default-class < 0.2,- semigroups >= 0.3.4 && < 0.19,+ semigroups >= 0.3.4 && < 0.20, cubicbezier >= 0.6 && < 0.7,- hashable >= 0.1.2 && < 1.3,+ hashable >= 0.1.2 && < 1.4, mfsolve >= 0.3 && < 0.4 hs-source-dirs: src default-language: Haskell2010@@ -88,8 +89,8 @@ Diagrams.TwoD.Path.Turtle.Internal build-depends: HUnit >= 1.2 && < 1.7,- QuickCheck >= 2.4 && < 2.12,- containers >= 0.3 && < 0.6,+ QuickCheck >= 2.4 && < 2.14,+ containers >= 0.3 && < 0.7, test-framework >= 0.4 && < 0.9, test-framework-hunit >= 0.2 && < 0.4, test-framework-quickcheck2 >= 0.2 && < 0.4,
+ diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_cutByEx.svg view
binary file changed (absent → 2805 bytes)
+ diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_explodeBothEx.svg view
binary file changed (absent → 3774 bytes)
+ diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_explodeIntersectionsEx.svg view
binary file changed (absent → 3716 bytes)
+ diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_explodeSegmentsEx.svg view
binary file changed (absent → 3666 bytes)
+ src/Diagrams/TwoD/Path/IntersectionExtras.hs view
@@ -0,0 +1,286 @@+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE UndecidableInstances #-}+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}+-----------------------------------------------------------------------------+-- |+-- Module : Diagrams.TwoD.Path.IntersectionExtras+-- Copyright : (c) 2018 Mike Zuser+-- License : BSD-style (see LICENSE)+-- Maintainer : Mike Zuser <mikezuser@gmail.com>+--+-- Extra functions for working with the intersections of `Path`s. This+-- module was motivated by `explodeIntersections`. The rest of the module is+-- either functions that where needed to build it or functions to help+-- consume it.+-----------------------------------------------------------------------------+module Diagrams.TwoD.Path.IntersectionExtras+ ( -- * Intersection Parameters+ intersectParams, intersectParams'+ , intersectParamsP, intersectParamsP'+ , intersectParamsT, intersectParamsT'+ , intersectParamsTS, intersectParamsTS'+ -- * Cutting Paths and Trails+ , cutBy, cutBy'+ , cutPBy, cutPBy'+ , cutTBy, cutTBy'+ -- * Rad Explosions+ , explodeSegments+ , explodeIntersections, explodeIntersections'+ , explodeBoth, explodeBoth'+ -- * Consuming Cut Paths+ , OnSections(..)+ ) where+import Data.List++import Diagrams.Prelude+import Diagrams.TwoD.Segment++-- defEps uses the value from Diagrams.TwoD.Path+defEps :: Fractional n => n+defEps = 1e-8++-----------------------------------------------------------------------------+-- Intersection Parameters --------------------------------------------------+-----------------------------------------------------------------------------++-- | Find the intersect parameters for each component trail of two pathlike+-- objects when the objects are intersected, returning a seperate list for+-- each trail.+intersectParams :: (InSpace V2 n t, SameSpace t s, ToPath t, ToPath s, OrderedField n) =>+ t -> s -> ([[n]], [[n]])+intersectParams = intersectParams' defEps++-- | `intersectParams` using the given tolerance.+intersectParams' :: (InSpace V2 n t, SameSpace t s, ToPath t, ToPath s, OrderedField n) =>+ n -> t -> s -> ([[n]], [[n]])+intersectParams' eps as bs = intersectParamsP' eps (toPath as) (toPath bs)++-- | Find the intersect parameters for each component trail of two+-- paths when the paths are intersected, returning a seperate list for+-- each trail.+intersectParamsP :: OrderedField n => Path V2 n -> Path V2 n -> ([[n]], [[n]])+intersectParamsP = intersectParamsP' defEps++-- | `intersectParamsP` using the given tolerance.+intersectParamsP' :: OrderedField n => n -> Path V2 n -> Path V2 n -> ([[n]], [[n]])+intersectParamsP' eps as bs = (ps, qs)+ where+ is = map (flip map (pathTrails bs) . intersectParamsT' eps) (pathTrails as)+ ps = map (concat . map fst) is+ qs = map (concat . map snd) (transpose is)++-- | Find the intersect parameters between two located trails.+intersectParamsT :: OrderedField n =>+ Located (Trail V2 n) -> Located (Trail V2 n) -> ([n], [n])+intersectParamsT = intersectParamsT' defEps++-- | `intersectParamsT` using the given tolerance.+intersectParamsT' :: OrderedField n =>+ n -> Located (Trail V2 n) -> Located (Trail V2 n) -> ([n], [n])+intersectParamsT' eps as bs = (reparam ps, reparam qs)+ where+ (ps, qs) = intersectParamsTS' eps as bs+ reparam segs = concat $ zipWith f [(0::Int)..] segs+ where f segNo = map $ \p -> (fromIntegral segNo + p) / genericLength segs++-- | Find the intersect parameters for each component segment of two+-- located trails when the trails are intersected, returning a+-- list for each trail containing a list of intersections for+-- each segemnt of that trail.+intersectParamsTS :: OrderedField n =>+ Located (Trail V2 n) -> Located (Trail V2 n) -> ([[n]], [[n]])+intersectParamsTS = intersectParamsTS' defEps++-- | `intersectParamsTS` using the given tolerance.+intersectParamsTS' :: OrderedField n =>+ n -> Located (Trail V2 n) -> Located (Trail V2 n) -> ([[n]], [[n]])+intersectParamsTS' eps as bs = (ps, qs)+ where+ (as', bs') = (as, bs) & both %~ (zip [0..] . fixTrail)+ is = map (flip map bs' . isect) as'+ isect (i, a) (j, b)+ | a == b = []+ | otherwise = filter (not . ends)+ . map (\(p, q, _) -> (p, q))+ $ segmentSegment eps a b+ where+ ends (p, q) = adjacent && min p q `near` 0 && max p q `near` 1+ adjacent = as == bs && (abs (i - j) == 1 || min i j == 0 && max i j == length as' - 1)+ near x n = abs (x - n) < eps+ ps = map (map fst . concat) is+ qs = map (map snd . concat) (transpose is)++-----------------------------------------------------------------------------+-- Cutting Paths and Trails -------------------------------------------------+-----------------------------------------------------------------------------++-- | Seperate a pathlike object into sections at every point it intersects+-- a second pathlike object, returning a list of sections for each component+-- trail.+--+-- <<diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_cutByEx.svg#diagram=cutByEx&width=300>>+--+-- > cutByEx = onSections (squares `cutBy` line) colorLines+-- > <> stroke line+-- > where+-- > squares, line :: Path V2 Double+-- > squares = square 1+-- > <> square 1 # rotate (1/8 @@ turn)+-- > line = hrule 2+-- > colorLines = map (map lc)+-- > [ [ red, orange]+-- > , [blue, purple] ]+cutBy :: (OrderedField n, Real n, InSpace V2 n t, SameSpace t s, ToPath t, ToPath s) =>+ t -> s -> [[Located (Trail V2 n)]]+cutBy = cutBy' defEps++-- | `cutBy` using the given tolerance for calculating intersections.+cutBy' :: (OrderedField n, Real n, InSpace V2 n t, SameSpace t s, ToPath t, ToPath s) =>+ n -> t -> s -> [[Located (Trail V2 n)]]+cutBy' eps a b = cutPBy' eps (toPath a) (toPath b)++-- | Seperate a path into sections at every point it intersects a second path,+-- returning a list of sections for each component trail.+cutPBy :: (OrderedField n, Real n) => Path V2 n -> Path V2 n -> [[Located (Trail V2 n)]]+cutPBy = cutPBy' defEps++-- | `cutPBy` using the given tolerance for calculating intersections.+cutPBy' :: (OrderedField n, Real n) => n -> Path V2 n -> Path V2 n -> [[Located (Trail V2 n)]]+cutPBy' eps p1 p2 = map (flip (cutTBy' eps) p2) (pathTrails p1)++-- | Seperate a located trail into sections at every point it intersects a path.+cutTBy :: (OrderedField n, Real n) => Located (Trail V2 n) -> Path V2 n -> [Located (Trail V2 n)]+cutTBy = cutTBy' defEps++-- | `cutTBy` using the given tolerance for calculating intersections.+cutTBy' :: (OrderedField n, Real n) => n -> Located (Trail V2 n) -> Path V2 n -> [Located (Trail V2 n)]+cutTBy' eps t p+ | null isects = [t]+ | null nearEnds && norm (start .-. end) < eps = gluedEnds+ | otherwise = subsections+ where+ subsections = zipWith (section t) (0:isects) (isects++[1])+ isects = sortAndAvoidEmpty notNearEnds+ sortAndAvoidEmpty = map head . groupBy (\a b -> abs (a - b) < eps) . sort+ (notNearEnds, nearEnds) = partition (\p -> (eps < p) && (p < 1-eps)) rawIsects+ rawIsects = concatMap (fst . intersectParamsT' eps t) (pathTrails p)++ start = head subsections `atParam` 0+ end = last subsections `atParam` 1+ gluedEnds = unfixTrail (fixTrail (last subsections) ++ fixTrail (head subsections))+ : init (tail subsections)++-----------------------------------------------------------------------------+-- Rad Explosions -----------------------------------------------------------+-----------------------------------------------------------------------------++-- | explodePath specialized to return located trails. This provides the compiler+-- the necessary type information to use it with `onSections` without providing+-- a type annotation.+--+-- <<diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_explodeSegmentsEx.svg#diagram=explodeSegmentsEx&width=300>>+--+-- > explodeSegmentsEx = onSections (explodeSegments squares) colorLines+-- > where+-- > squares = square 1+-- > <> square 1 # rotate (1/8 @@ turn)+-- > colorLines = map (map lc)+-- > [ [ red, yellow, gold, orange]+-- > , [blue, violet, purple, indigo] ]+explodeSegments :: (Metric v, OrderedField n) => Path v n -> [[Located (Trail v n)]]+explodeSegments = explodePath++-- | Turn a path a list of component trails, then cut those segments at all+-- their intersections.+--+-- <<diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_explodeIntersectionsEx.svg#diagram=explodeIntersectionsEx&width=300>>+--+-- > explodeIntersectionsEx = onSections (explodeIntersections squares) colorLines+-- > where+-- > squares = square 1+-- > <> square 1 # rotate (1/8 @@ turn)+-- > colorLines = map (map lc)+-- > [ [ gray, red, orange, yellow, green, blue, indigo, violet]+-- > , [black, crimson, darkorange, gold, darkgreen, darkblue, midnightblue, darkviolet] ]+explodeIntersections :: (OrderedField n, Real n) => Path V2 n -> [[Located (Trail V2 n)]]+explodeIntersections = explodeIntersections' defEps++-- | `explodeIntersections` using the given tolerance for calculating intersections.+explodeIntersections' :: (OrderedField n, Real n) => n -> Path V2 n -> [[Located (Trail V2 n)]]+explodeIntersections' eps path = cutBy' eps path path++-- | Turn a path into a list of component segments for each component trail,+-- then cut those segments at all their intersections.+--+-- <<diagrams/src_Diagrams_TwoD_Path_IntersectionExtras_explodeBothEx.svg#diagram=explodeBothEx&width=300>>+--+-- > explodeBothEx = onSections (explodeBoth squares) colorLines+-- > where+-- > squares = square 1+-- > <> square 1 # rotate (1/8 @@ turn)+-- > colorLines = map (map (map lc))+-- > [ cycle [ [ gray, red, orange], [yellow, green, blue] ]+-- > , cycle [ [black, crimson, darkorange], [ gold, darkgreen, darkblue] ] ]+explodeBoth :: (OrderedField n, Real n) => Path V2 n -> [[[Located (Trail V2 n)]]]+explodeBoth = explodeBoth' defEps++-- | `explodeBoth` using the given tolerance for calculating intersections.+explodeBoth' :: (OrderedField n, Real n) => n -> Path V2 n -> [[[Located (Trail V2 n)]]]+explodeBoth' eps path = map (map (flip (cutTBy' eps) path)) $ explodePath path++-----------------------------------------------------------------------------+-- Consuming Cut Paths -----------------------------------------------------+-----------------------------------------------------------------------------+class OnSections ps fs b n | ps b -> fs n, fs -> b n where+ -- | Zipply apply an arbitrarily nested list of attributes to the same shape+ -- of lists of pathlike objects, monoidally combining the results.+ --+ -- See examples for `cutBy`, `explodeSegments`, `explodeIntersections`, and `explodeBoth`.+ onSections :: ps -> fs -> QDiagram b V2 n Any++-- Need to list out the instances rather than using overlaping instances+-- with ToPath in order to use the fundep (ps b -> fs).++instance (TypeableFloat n, OnSections ps fs b n) =>+ OnSections [ps] [fs] b n where+ onSections ps fs = mconcat $ zipWith onSections ps fs++instance (TypeableFloat n, Renderable (Path V2 n) b) =>+ OnSections (Path V2 n) (QDiagram b V2 n Any -> QDiagram b V2 n Any) b n where+ onSections ps fs = fs $ stroke ps++instance (TypeableFloat n, Renderable (Path V2 n) b) =>+ OnSections (Located (Trail V2 n)) (QDiagram b V2 n Any -> QDiagram b V2 n Any) b n where+ onSections ps fs = fs $ stroke ps++instance (TypeableFloat n, Renderable (Path V2 n) b) =>+ OnSections (Located (Trail' l V2 n)) (QDiagram b V2 n Any -> QDiagram b V2 n Any) b n where+ onSections ps fs = fs $ stroke ps++instance (TypeableFloat n, Renderable (Path V2 n) b) =>+ OnSections (Located [Segment Closed V2 n]) (QDiagram b V2 n Any -> QDiagram b V2 n Any) b n where+ onSections ps fs = fs $ stroke ps++instance (TypeableFloat n, Renderable (Path V2 n) b) =>+ OnSections (Located (Segment Closed V2 n)) (QDiagram b V2 n Any -> QDiagram b V2 n Any) b n where+ onSections ps fs = fs $ stroke ps++instance (TypeableFloat n, Renderable (Path V2 n) b) =>+ OnSections (Trail V2 n) (QDiagram b V2 n Any -> QDiagram b V2 n Any) b n where+ onSections ps fs = fs $ stroke ps++instance (TypeableFloat n, Renderable (Path V2 n) b) =>+ OnSections (Trail' l V2 n) (QDiagram b V2 n Any -> QDiagram b V2 n Any) b n where+ onSections ps fs = fs $ stroke ps++instance (TypeableFloat n, Renderable (Path V2 n) b) =>+ OnSections (FixedSegment V2 n) (QDiagram b V2 n Any -> QDiagram b V2 n Any) b n where+ onSections ps fs = fs $ stroke ps++instance (TypeableFloat n, Renderable (Path V2 n) b) =>+ OnSections (QDiagram b V2 n Any) (QDiagram b V2 n Any -> QDiagram b V2 n Any) b n where+ onSections ps fs = fs ps