{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Diagrams.Path
(
Path(..), pathTrails
, ToPath (..)
, pathFromTrail
, pathFromTrailAt
, pathFromLocTrail
, pathPoints
, pathVertices'
, pathVertices
, pathOffsets
, pathCentroid
, pathLocSegments, fixPath
, scalePath
, reversePath
, explodePath
, partitionPath
) where
import Control.Arrow ((***))
import Control.Lens hiding (at, transform, ( # ))
import qualified Data.Foldable as F
import Data.List (partition)
import Data.Semigroup
import Data.Typeable
import Diagrams.Align
import Diagrams.Core
import Diagrams.Located
import Diagrams.Points
import Diagrams.Segment
import Diagrams.Trail
import Diagrams.TrailLike
import Diagrams.Transform
import Linear.Metric
import Linear.Vector
import Data.Serialize (Serialize)
import GHC.Generics (Generic)
newtype Path v n = Path [Located (Trail v n)]
deriving (NonEmpty (Path v n) -> Path v n
Path v n -> Path v n -> Path v n
forall b. Integral b => b -> Path v n -> Path v n
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
forall (v :: * -> *) n. NonEmpty (Path v n) -> Path v n
forall (v :: * -> *) n. Path v n -> Path v n -> Path v n
forall (v :: * -> *) n b. Integral b => b -> Path v n -> Path v n
stimes :: forall b. Integral b => b -> Path v n -> Path v n
$cstimes :: forall (v :: * -> *) n b. Integral b => b -> Path v n -> Path v n
sconcat :: NonEmpty (Path v n) -> Path v n
$csconcat :: forall (v :: * -> *) n. NonEmpty (Path v n) -> Path v n
<> :: Path v n -> Path v n -> Path v n
$c<> :: forall (v :: * -> *) n. Path v n -> Path v n -> Path v n
Semigroup, Path v n
[Path v n] -> Path v n
Path v n -> Path v n -> Path v n
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall (v :: * -> *) n. Semigroup (Path v n)
forall (v :: * -> *) n. Path v n
forall (v :: * -> *) n. [Path v n] -> Path v n
forall (v :: * -> *) n. Path v n -> Path v n -> Path v n
mconcat :: [Path v n] -> Path v n
$cmconcat :: forall (v :: * -> *) n. [Path v n] -> Path v n
mappend :: Path v n -> Path v n -> Path v n
$cmappend :: forall (v :: * -> *) n. Path v n -> Path v n -> Path v n
mempty :: Path v n
$cmempty :: forall (v :: * -> *) n. Path v n
Monoid, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (v :: * -> *) n x. Rep (Path v n) x -> Path v n
forall (v :: * -> *) n x. Path v n -> Rep (Path v n) x
$cto :: forall (v :: * -> *) n x. Rep (Path v n) x -> Path v n
$cfrom :: forall (v :: * -> *) n x. Path v n -> Rep (Path v n) x
Generic
, Typeable
)
instance (OrderedField n, Metric v, Serialize (v n), Serialize (V (v n) (N (v n)))) =>
Serialize (Path v n)
instance Wrapped (Path v n) where
type Unwrapped (Path v n) = [Located (Trail v n)]
_Wrapped' :: Iso' (Path v n) (Unwrapped (Path v n))
_Wrapped' = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(Path [Located (Trail v n)]
x) -> [Located (Trail v n)]
x) forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
instance Rewrapped (Path v n) (Path v' n')
instance Each (Path v n) (Path v' n') (Located (Trail v n)) (Located (Trail v' n')) where
each :: Traversal
(Path v n)
(Path v' n')
(Located (Trail v n))
(Located (Trail v' n'))
each = forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse
instance AsEmpty (Path v n) where
_Empty :: Prism' (Path v n) ()
_Empty = forall s. Wrapped s => Iso' s (Unwrapped s)
_Wrapped' forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. AsEmpty a => Prism' a ()
_Empty
instance Cons (Path v n) (Path v' n') (Located (Trail v n)) (Located (Trail v' n')) where
_Cons :: Prism
(Path v n)
(Path v' n')
(Located (Trail v n), Path v n)
(Located (Trail v' n'), Path v' n')
_Cons = forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s t a b. Cons s t a b => Prism s t (a, s) (b, t)
_Cons forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> * -> *) (g :: * -> * -> *) s t a b s' t' a' b'.
(Bifunctor f, Bifunctor g) =>
AnIso s t a b
-> AnIso s' t' a' b' -> Iso (f s s') (g t t') (f a a') (g b b')
bimapping forall a. a -> a
id forall s t. Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s
_Unwrapped
{-# INLINE _Cons #-}
instance Snoc (Path v n) (Path v' n') (Located (Trail v n)) (Located (Trail v' n')) where
_Snoc :: Prism
(Path v n)
(Path v' n')
(Path v n, Located (Trail v n))
(Path v' n', Located (Trail v' n'))
_Snoc = forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s t a b. Snoc s t a b => Prism s t (s, a) (t, b)
_Snoc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> * -> *) (g :: * -> * -> *) s t a b s' t' a' b'.
(Bifunctor f, Bifunctor g) =>
AnIso s t a b
-> AnIso s' t' a' b' -> Iso (f s s') (g t t') (f a a') (g b b')
bimapping forall s t. Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s
_Unwrapped forall a. a -> a
id
{-# INLINE _Snoc #-}
pathTrails :: Path v n -> [Located (Trail v n)]
pathTrails :: forall (v :: * -> *) n. Path v n -> [Located (Trail v n)]
pathTrails = forall s. Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
deriving instance Show (v n) => Show (Path v n)
deriving instance Eq (v n) => Eq (Path v n)
deriving instance Ord (v n) => Ord (Path v n)
type instance V (Path v n) = v
type instance N (Path v n) = n
instance (Additive v, Num n) => HasOrigin (Path v n) where
moveOriginTo :: Point (V (Path v n)) (N (Path v n)) -> Path v n -> Path v n
moveOriginTo = forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over forall s. Wrapped s => Iso' s (Unwrapped s)
_Wrapped' forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall t. HasOrigin t => Point (V t) (N t) -> t -> t
moveOriginTo
instance (Metric v, OrderedField n) => TrailLike (Path v n) where
trailLike :: Located (Trail (V (Path v n)) (N (Path v n))) -> Path v n
trailLike = forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. a -> [a] -> [a]
:[])
instance (HasLinearMap v, Metric v, OrderedField n)
=> Transformable (Path v n) where
transform :: Transformation (V (Path v n)) (N (Path v n))
-> Path v n -> Path v n
transform = forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall t. Transformable t => Transformation (V t) (N t) -> t -> t
transform
instance (Metric v, OrderedField n) => Enveloped (Path v n) where
getEnvelope :: Path v n -> Envelope (V (Path v n)) (N (Path v n))
getEnvelope = forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
F.foldMap Located (Trail v n) -> Envelope v n
trailEnvelope forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
where trailEnvelope :: Located (Trail v n) -> Envelope v n
trailEnvelope :: Located (Trail v n) -> Envelope v n
trailEnvelope (forall a. Located a -> (Point (V a) (N a), a)
viewLoc -> (Point (V (Trail v n)) (N (Trail v n))
p, Trail v n
t)) = forall t. HasOrigin t => Point (V t) (N t) -> t -> t
moveOriginTo ((-n
1) forall (v :: * -> *) n.
(Functor v, Num n) =>
n -> Point v n -> Point v n
*. Point (V (Trail v n)) (N (Trail v n))
p) (forall a. Enveloped a => a -> Envelope (V a) (N a)
getEnvelope Trail v n
t)
instance (Metric v, OrderedField n) => Juxtaposable (Path v n) where
juxtapose :: Vn (Path v n) -> Path v n -> Path v n -> Path v n
juxtapose = forall a. (Enveloped a, HasOrigin a) => Vn a -> a -> a -> a
juxtaposeDefault
instance (Metric v, OrderedField n) => Alignable (Path v n) where
defaultBoundary :: forall (v :: * -> *) n.
(V (Path v n) ~ v, N (Path v n) ~ n) =>
v n -> Path v n -> Point v n
defaultBoundary = forall a (v :: * -> *) n.
(V a ~ v, N a ~ n, Enveloped a) =>
v n -> a -> Point v n
envelopeBoundary
instance (HasLinearMap v, Metric v, OrderedField n)
=> Renderable (Path v n) NullBackend where
render :: NullBackend
-> Path v n -> Render NullBackend (V (Path v n)) (N (Path v n))
render NullBackend
_ Path v n
_ = forall a. Monoid a => a
mempty
class ToPath t where
toPath :: (Metric (V t), OrderedField (N t)) => t -> Path (V t) (N t)
instance ToPath (Path v n) where
toPath :: (Metric (V (Path v n)), OrderedField (N (Path v n))) =>
Path v n -> Path (V (Path v n)) (N (Path v n))
toPath = forall a. a -> a
id
instance ToPath (Trail v n) where
toPath :: (Metric (V (Trail v n)), OrderedField (N (Trail v n))) =>
Trail v n -> Path (V (Trail v n)) (N (Trail v n))
toPath = forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Trail v n -> Path v n
pathFromTrail
instance ToPath (Trail' l v n) where
toPath :: (Metric (V (Trail' l v n)), OrderedField (N (Trail' l v n))) =>
Trail' l v n -> Path (V (Trail' l v n)) (N (Trail' l v n))
toPath Trail' l v n
t = forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path [forall l (v :: * -> *) n. Trail' l v n -> Trail v n
Trail Trail' l v n
t forall a. a -> Point (V a) (N a) -> Located a
`at` forall (f :: * -> *) a. (Additive f, Num a) => Point f a
origin]
instance ToPath (Located (Trail v n)) where
toPath :: (Metric (V (Located (Trail v n))),
OrderedField (N (Located (Trail v n)))) =>
Located (Trail v n)
-> Path (V (Located (Trail v n))) (N (Located (Trail v n)))
toPath = forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Located (Trail v n) -> Path v n
pathFromLocTrail
instance ToPath (Located (Trail' l v n)) where
toPath :: (Metric (V (Located (Trail' l v n))),
OrderedField (N (Located (Trail' l v n)))) =>
Located (Trail' l v n)
-> Path (V (Located (Trail' l v n))) (N (Located (Trail' l v n)))
toPath = forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Located (Trail v n) -> Path v n
pathFromLocTrail forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. SameSpace a b => (a -> b) -> Located a -> Located b
mapLoc forall l (v :: * -> *) n. Trail' l v n -> Trail v n
Trail
instance ToPath (Located (Segment Closed v n)) where
toPath :: (Metric (V (Located (Segment Closed v n))),
OrderedField (N (Located (Segment Closed v n)))) =>
Located (Segment Closed v n)
-> Path
(V (Located (Segment Closed v n)))
(N (Located (Segment Closed v n)))
toPath (forall a. Located a -> (Point (V a) (N a), a)
viewLoc -> (Point (V (Segment Closed v n)) (N (Segment Closed v n))
p,Segment Closed v n
seg))
= forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path [forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
[Segment Closed v n] -> Trail v n
trailFromSegments [Segment Closed v n
seg] forall a. a -> Point (V a) (N a) -> Located a
`at` Point (V (Segment Closed v n)) (N (Segment Closed v n))
p]
instance ToPath (Located [Segment Closed v n]) where
toPath :: (Metric (V (Located [Segment Closed v n])),
OrderedField (N (Located [Segment Closed v n]))) =>
Located [Segment Closed v n]
-> Path
(V (Located [Segment Closed v n]))
(N (Located [Segment Closed v n]))
toPath (forall a. Located a -> (Point (V a) (N a), a)
viewLoc -> (Point (V [Segment Closed v n]) (N [Segment Closed v n])
p,[Segment Closed v n]
segs))
= forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path [forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
[Segment Closed v n] -> Trail v n
trailFromSegments [Segment Closed v n]
segs forall a. a -> Point (V a) (N a) -> Located a
`at` Point (V [Segment Closed v n]) (N [Segment Closed v n])
p]
instance ToPath (FixedSegment v n) where
toPath :: (Metric (V (FixedSegment v n)),
OrderedField (N (FixedSegment v n))) =>
FixedSegment v n
-> Path (V (FixedSegment v n)) (N (FixedSegment v n))
toPath = forall t.
(ToPath t, Metric (V t), OrderedField (N t)) =>
t -> Path (V t) (N t)
toPath forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall n (v :: * -> *).
(Num n, Additive v) =>
FixedSegment v n -> Located (Segment Closed v n)
fromFixedSeg
instance ToPath a => ToPath [a] where
toPath :: (Metric (V [a]), OrderedField (N [a])) =>
[a] -> Path (V [a]) (N [a])
toPath = forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
F.foldMap forall t.
(ToPath t, Metric (V t), OrderedField (N t)) =>
t -> Path (V t) (N t)
toPath
pathFromTrail :: (Metric v, OrderedField n) => Trail v n -> Path v n
pathFromTrail :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Trail v n -> Path v n
pathFromTrail = forall t. TrailLike t => Located (Trail (V t) (N t)) -> t
trailLike forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. a -> Point (V a) (N a) -> Located a
`at` forall (f :: * -> *) a. (Additive f, Num a) => Point f a
origin)
pathFromTrailAt :: (Metric v, OrderedField n) => Trail v n -> Point v n -> Path v n
pathFromTrailAt :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Trail v n -> Point v n -> Path v n
pathFromTrailAt Trail v n
t Point v n
p = forall t. TrailLike t => Located (Trail (V t) (N t)) -> t
trailLike (Trail v n
t forall a. a -> Point (V a) (N a) -> Located a
`at` Point v n
p)
pathFromLocTrail :: (Metric v, OrderedField n) => Located (Trail v n) -> Path v n
pathFromLocTrail :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Located (Trail v n) -> Path v n
pathFromLocTrail = forall t. TrailLike t => Located (Trail (V t) (N t)) -> t
trailLike
pathVertices' :: (Metric v, OrderedField n) => n -> Path v n -> [[Point v n]]
pathVertices' :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
n -> Path v n -> [[Point v n]]
pathVertices' n
toler = forall a b. (a -> b) -> [a] -> [b]
map (forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
n -> Located (Trail v n) -> [Point v n]
trailVertices' n
toler) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
pathVertices :: (Metric v, OrderedField n) => Path v n -> [[Point v n]]
pathVertices :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Path v n -> [[Point v n]]
pathVertices = forall a b. (a -> b) -> [a] -> [b]
map forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Located (Trail v n) -> [Point v n]
trailVertices forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
pathPoints :: (Metric v, OrderedField n) => Path v n -> [[Point v n]]
pathPoints :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Path v n -> [[Point v n]]
pathPoints = forall a b. (a -> b) -> [a] -> [b]
map forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Located (Trail v n) -> [Point v n]
trailPoints forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
pathOffsets :: (Metric v, OrderedField n) => Path v n -> [v n]
pathOffsets :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Path v n -> [v n]
pathOffsets = forall a b. (a -> b) -> [a] -> [b]
map (forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Trail v n -> v n
trailOffset forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Located a -> a
unLoc) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
pathCentroid :: (Metric v, OrderedField n) => Path v n -> Point v n
pathCentroid :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Path v n -> Point v n
pathCentroid = forall (v :: * -> *) n.
(Additive v, Fractional n) =>
[Point v n] -> Point v n
centroid forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Path v n -> [[Point v n]]
pathVertices
pathLocSegments :: (Metric v, OrderedField n) => Path v n -> [[Located (Segment Closed v n)]]
pathLocSegments :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Path v n -> [[Located (Segment Closed v n)]]
pathLocSegments = forall a b. (a -> b) -> [a] -> [b]
map forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Located (Trail v n) -> [Located (Segment Closed v n)]
trailLocSegments forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
fixPath :: (Metric v, OrderedField n) => Path v n -> [[FixedSegment v n]]
fixPath :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Path v n -> [[FixedSegment v n]]
fixPath = forall a b. (a -> b) -> [a] -> [b]
map forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Located (Trail v n) -> [FixedSegment v n]
fixTrail forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
explodePath :: (V t ~ v, N t ~ n, TrailLike t) => Path v n -> [[t]]
explodePath :: forall t (v :: * -> *) n.
(V t ~ v, N t ~ n, TrailLike t) =>
Path v n -> [[t]]
explodePath = forall a b. (a -> b) -> [a] -> [b]
map forall t (v :: * -> *) n.
(V t ~ v, N t ~ n, TrailLike t) =>
Located (Trail v n) -> [t]
explodeTrail forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
partitionPath :: (Located (Trail v n) -> Bool) -> Path v n -> (Path v n, Path v n)
partitionPath :: forall (v :: * -> *) n.
(Located (Trail v n) -> Bool) -> Path v n -> (Path v n, Path v n)
partitionPath Located (Trail v n) -> Bool
p = (forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall s. Wrapped s => Iso' (Unwrapped s) s
_Unwrapped' forall (a :: * -> * -> *) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall s. Wrapped s => Iso' (Unwrapped s) s
_Unwrapped') forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (a -> Bool) -> [a] -> ([a], [a])
partition Located (Trail v n) -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s. Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op forall (v :: * -> *) n. [Located (Trail v n)] -> Path v n
Path
scalePath :: (HasLinearMap v, Metric v, OrderedField n) => n -> Path v n -> Path v n
scalePath :: forall (v :: * -> *) n.
(HasLinearMap v, Metric v, OrderedField n) =>
n -> Path v n -> Path v n
scalePath n
d Path v n
p = forall s t a b. AnIso s t a b -> (t -> s) -> b -> a
under (forall (v :: * -> *) n a b.
(InSpace v n a, SameSpace a b, HasOrigin a, HasOrigin b) =>
Point v n -> Iso a b a b
movedFrom (forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Path v n -> Point v n
pathCentroid Path v n
p)) (forall (v :: * -> *) n a.
(InSpace v n a, Eq n, Fractional n, Transformable a) =>
n -> a -> a
scale n
d) Path v n
p
reversePath :: (Metric v, OrderedField n) => Path v n -> Path v n
reversePath :: forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Path v n -> Path v n
reversePath = forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => Setter (f a) (f b) a b
mapped forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ forall (v :: * -> *) n.
(Metric v, OrderedField n) =>
Located (Trail v n) -> Located (Trail v n)
reverseLocTrail
instance (Metric v, OrderedField n) => Reversing (Path v n) where
reversing :: Path v n -> Path v n
reversing = forall s. Wrapped s => Iso' s (Unwrapped s)
_Wrapped' forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => Setter (f a) (f b) a b
mapped forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ forall t. Reversing t => t -> t
reversing