diff --git a/haddock.txt b/haddock.txt
index c414ab7..1fcc378 100644
--- a/haddock.txt
+++ b/haddock.txt
@@ -19,21 +19,20 @@
100% ( 4 / 4) in 'Reanimate.Svg.BoundingBox'
100% ( 3 / 3) in 'Reanimate.Blender'
100% ( 2 / 2) in 'Reanimate.Builtin.CirclePlot'
+ 97% ( 28 / 29) in 'Reanimate.Math.Common'
+ 92% ( 12 / 13) in 'Reanimate.Morph.Common'
+ 89% (101 /113) in 'Reanimate.Scene'
88% ( 7 / 8) in 'Reanimate.Transition'
- 86% ( 98 /114) in 'Reanimate.Scene'
+ 84% ( 31 / 37) in 'Geom2D.CubicBezier.Linear'
75% ( 3 / 4) in 'Reanimate.Svg.Unuse'
- 62% ( 23 / 37) in 'Geom2D.CubicBezier.Linear'
56% ( 10 / 18) in 'Reanimate.Svg'
44% ( 4 / 9) in 'Reanimate.LaTeX'
31% ( 4 / 13) in 'Reanimate.Render'
25% ( 1 / 4) in 'Reanimate.Builtin.Slide'
12% ( 2 / 17) in 'Reanimate.Math.SSSP'
- 10% ( 3 / 29) in 'Reanimate.Math.Common'
6% ( 5 / 84) in 'Reanimate.Math.Polygon'
6% ( 1 / 18) in 'Reanimate.Svg.LineCommand'
- 0% ( 0 / 13) in 'Reanimate.Morph.Common'
0% ( 0 / 10) in 'Reanimate.ColorSpace'
- 0% ( 0 / 8) in 'Reanimate.Misc'
0% ( 0 / 7) in 'Reanimate.Morph.Linear'
0% ( 0 / 7) in 'Reanimate.Math.Triangulate'
0% ( 0 / 5) in 'Reanimate.Builtin.Flip'
diff --git a/haddock_badge.json b/haddock_badge.json
index 0fb4ebc..ea97d81 100644
--- a/haddock_badge.json
+++ b/haddock_badge.json
@@ -1 +1 @@
- { "schemaVersion": 1, "label": "api docs", "message": "77%", "color": "success" }
+ { "schemaVersion": 1, "label": "api docs", "message": "69%", "color": "success" }
diff --git a/playground/snippets.js b/playground/snippets.js
index 57599ae..84e78b7 100644
--- a/playground/snippets.js
+++ b/playground/snippets.js
@@ -9,4 +9,4 @@ const snippets = [{"title": "Hello World","url": "https://reanimate.clozecards.c
,{"title": "Object Positions","url": "https://reanimate.clozecards.com/IAQhjO0Ke7h/195.svg","code": "env =\n addStatic (mkBackground \"white\") .\n mapA (withStrokeColor \"black\")\n\nanimation :: Animation\nanimation = env $\n sceneAnimation $ do\n -- Configure objects\n txt <- newText \"Center\"\n top <- newText \"Top\"\n oModifyS top $ \n oTopY .= screenTop\n topR <- newText \"Top right\"\n oModifyS topR $ do\n oTopY .= screenTop\n oRightX .= screenRight\n botR <- newText \"Bottom right\"\n oModifyS botR $ do\n oBottomY .= screenBottom\n oRightX .= screenRight\n botL <- newText \"Bottom left\"\n oModifyS botL $ do\n oBottomY .= screenBottom\n oLeftX .= screenLeft\n topL <- newText \"Top left\"\n oModifyS topL $ do\n oTopY .= screenTop\n oLeftX .= screenLeft\n -- Show objects\n oShow txt\n wait 1\n switchTo txt top\n switchTo top topR\n switchTo topR botR\n switchTo botR botL\n switchTo botL topL\n switchTo topL txt\n\nswitchTo src dst = do\n fork $ oFadeOut src 1\n oModify dst $ oOpacity .~ 1\n oFadeIn dst 1\n wait 1\n\nnewText txt =\n newObject $ scale 1.5 $ center $ latex txt\n"}
,{"title": "Camera","url": "https://reanimate.clozecards.com/CD5Bg7AwVkF/150.svg","code": "animation :: Animation\nanimation = docEnv $ mapA (withFillOpacity 1) $ sceneAnimation $ do\n cam <- newObject Camera\n\n txt <- newObject $ center $ latex \"Fixed (non-cam)\"\n oModifyS txt $ do\n oTopY .= screenTop \n oZIndex .= 2\n\n circle <- newObject $ Circle 1\n cameraAttach cam circle\n oModify circle $ oContext .~ withFillColor \"blue\"\n circleRight <- oRead circle oRightX\n\n box <- newObject $ Rectangle 2 2\n cameraAttach cam box\n oModify box $ oContext .~ withFillColor \"green\"\n oModify box $ oLeftX .~ circleRight\n boxCenter <- oRead box oCenterXY\n\n small <- newObject $ center $ latex \"This text is very small\"\n cameraAttach cam small\n oModifyS small $ do\n oCenterXY .= boxCenter\n oScale .= 0.1\n \n oShow txt\n oShow small\n oShow circle\n oShow box\n\n wait 1\n\n cameraFocus cam boxCenter\n waitOn $ do\n fork $ cameraPan cam 3 boxCenter\n fork $ cameraZoom cam 3 15\n \n wait 2\n cameraZoom cam 3 1\n cameraPan cam 1 (0,0)\n"}
];
-const playgroundVersion = "2020-08-26 (efa55)";
+const playgroundVersion = "2020-08-26 (ce105)";
diff --git a/reanimate-0.4.1.0-inplace/Geom2D.CubicBezier.Linear.hs.html b/reanimate-0.4.1.0-inplace/Geom2D.CubicBezier.Linear.hs.html
index a0657fe..1f9ea81 100644
--- a/reanimate-0.4.1.0-inplace/Geom2D.CubicBezier.Linear.hs.html
+++ b/reanimate-0.4.1.0-inplace/Geom2D.CubicBezier.Linear.hs.html
@@ -95,230 +95,242 @@ span.spaces { background: white }
76 , quadC2 :: !(V2 a)
77 } deriving (Show, Eq)
78
- 79 data OpenPath a = OpenPath [(V2 a, PathJoin a)] (V2 a)
- 80 deriving (Show, Eq)
- 81 data ClosedPath a = ClosedPath [(V2 a, PathJoin a)]
- 82 deriving (Show, Eq)
- 83
- 84 data PathJoin a
- 85 = JoinLine
- 86 | JoinCurve (V2 a) (V2 a)
- 87 deriving (Show, Eq)
- 88
- 89 data ClosedMetaPath a = ClosedMetaPath [(V2 a, MetaJoin a)]
- 90 deriving (Show, Eq)
- 91 data OpenMetaPath a = OpenMetaPath [(V2 a, MetaJoin a)] (V2 a)
+ 79 -- | Open cubicbezier path.
+ 80 data OpenPath a = OpenPath [(V2 a, PathJoin a)] (V2 a)
+ 81 deriving (Show, Eq)
+ 82
+ 83 -- | Closed cubicbezier path.
+ 84 data ClosedPath a = ClosedPath [(V2 a, PathJoin a)]
+ 85 deriving (Show, Eq)
+ 86
+ 87 -- | Join two points with either a straight line or a bezier
+ 88 -- curve with two control points.
+ 89 data PathJoin a
+ 90 = JoinLine
+ 91 | JoinCurve (V2 a) (V2 a)
92 deriving (Show, Eq)
93
- 94 data MetaJoin a
- 95 = MetaJoin
- 96 { metaTypeL :: MetaNodeType a
- 97 , tensionL :: C.Tension a
- 98 , tensionR :: C.Tension a
- 99 , metaTypeR :: MetaNodeType a
- 100 }
- 101 | Controls (V2 a) (V2 a)
- 102 deriving (Show, Eq)
- 103
- 104 data MetaNodeType a
- 105 = Open
- 106 | Curl { curlgamma :: a }
- 107 | Direction { nodedir :: V2 a }
- 108 deriving (Show, Eq)
- 109
- 110 ------------------------------------------------------------
- 111 -- Methods
- 112
- 113 -- | Convert a quadratic bezier to a cubic bezier.
- 114 quadToCubic :: Fractional a => QuadBezier a -> CubicBezier a
- 115 quadToCubic = upCast . C.quadToCubic . downCast
- 116
- 117 -- | @arcLength c t tol@ finds the arclength of the bezier @c@ at @t@,
- 118 -- within given tolerance @tol@.
- 119 arcLength :: CubicBezier Double -> Double -> Double -> Double
- 120 arcLength bezier t tol = C.arcLength (downCast bezier) t tol
- 121
- 122 -- | @arcLengthParam c len tol@ finds the parameter where the curve @c@
- 123 -- has the arclength @len@, within tolerance @tol@.
- 124 arcLengthParam :: CubicBezier Double -> Double -> Double -> Double
- 125 arcLengthParam bezier t tol = C.arcLengthParam (downCast bezier) t tol
- 126
- 127 -- | Return @False@ if some points fall outside a line with a thickness of the given tolerance.
- 128 colinear :: CubicBezier Double -> Double -> Bool
- 129 colinear bezier tol = C.colinear (downCast bezier) tol
- 130
- 131 -- | Calculate a value on the bezier curve.
- 132 evalBezier :: (C.GenericBezier b, V.Unbox a, Fractional a) => b a -> a -> V2 a
- 133 evalBezier c p = upCast $ C.evalBezier c p
- 134
- 135 -- | Calculate a value and the first derivative on the curve.
- 136 evalBezierDeriv :: (V.Unbox a, Fractional a,C.GenericBezier b) => b a -> a -> (V2 a, V2 a)
- 137 evalBezierDeriv c p = upCast $ C.evalBezierDeriv c p
- 138
- 139 -- | Find the parameter where the bezier curve is horizontal.
- 140 bezierHoriz :: CubicBezier Double -> [Double]
- 141 bezierHoriz = C.bezierHoriz . downCast
- 142
- 143 -- | Find the parameter where the bezier curve is vertical.
- 144 bezierVert :: CubicBezier Double -> [Double]
- 145 bezierVert = C.bezierVert . downCast
- 146
- 147 -- | Create a normal path from a metapath.
- 148 unmetaOpen :: OpenMetaPath Double -> OpenPath Double
- 149 unmetaOpen = upCast . C.unmetaOpen . downCast
- 150
- 151 unmetaClosed :: ClosedMetaPath Double -> ClosedPath Double
- 152 unmetaClosed = upCast . C.unmetaClosed . downCast
+ 94 -- | Closed meta path.
+ 95 data ClosedMetaPath a = ClosedMetaPath [(V2 a, MetaJoin a)]
+ 96 deriving (Show, Eq)
+ 97
+ 98 -- | Open meta path
+ 99 data OpenMetaPath a = OpenMetaPath [(V2 a, MetaJoin a)] (V2 a)
+ 100 deriving (Show, Eq)
+ 101
+ 102 -- | Join two meta points with either a bezier curve or tension
+ 103 -- contraints.
+ 104 data MetaJoin a
+ 105 = MetaJoin
+ 106 { metaTypeL :: MetaNodeType a
+ 107 , tensionL :: C.Tension a
+ 108 , tensionR :: C.Tension a
+ 109 , metaTypeR :: MetaNodeType a
+ 110 }
+ 111 | Controls (V2 a) (V2 a)
+ 112 deriving (Show, Eq)
+ 113
+ 114 -- | Node constraint type.
+ 115 data MetaNodeType a
+ 116 = Open
+ 117 | Curl { curlgamma :: a }
+ 118 | Direction { nodedir :: V2 a }
+ 119 deriving (Show, Eq)
+ 120
+ 121 ------------------------------------------------------------
+ 122 -- Methods
+ 123
+ 124 -- | Convert a quadratic bezier to a cubic bezier.
+ 125 quadToCubic :: Fractional a => QuadBezier a -> CubicBezier a
+ 126 quadToCubic = upCast . C.quadToCubic . downCast
+ 127
+ 128 -- | @arcLength c t tol@ finds the arclength of the bezier @c@ at @t@,
+ 129 -- within given tolerance @tol@.
+ 130 arcLength :: CubicBezier Double -> Double -> Double -> Double
+ 131 arcLength bezier t tol = C.arcLength (downCast bezier) t tol
+ 132
+ 133 -- | @arcLengthParam c len tol@ finds the parameter where the curve @c@
+ 134 -- has the arclength @len@, within tolerance @tol@.
+ 135 arcLengthParam :: CubicBezier Double -> Double -> Double -> Double
+ 136 arcLengthParam bezier t tol = C.arcLengthParam (downCast bezier) t tol
+ 137
+ 138 -- | Return @False@ if some points fall outside a line with a thickness of the given tolerance.
+ 139 colinear :: CubicBezier Double -> Double -> Bool
+ 140 colinear bezier tol = C.colinear (downCast bezier) tol
+ 141
+ 142 -- | Calculate a value on the bezier curve.
+ 143 evalBezier :: (C.GenericBezier b, V.Unbox a, Fractional a) => b a -> a -> V2 a
+ 144 evalBezier c p = upCast $ C.evalBezier c p
+ 145
+ 146 -- | Calculate a value and the first derivative on the curve.
+ 147 evalBezierDeriv :: (V.Unbox a, Fractional a,C.GenericBezier b) => b a -> a -> (V2 a, V2 a)
+ 148 evalBezierDeriv c p = upCast $ C.evalBezierDeriv c p
+ 149
+ 150 -- | Find the parameter where the bezier curve is horizontal.
+ 151 bezierHoriz :: CubicBezier Double -> [Double]
+ 152 bezierHoriz = C.bezierHoriz . downCast
153
- 154 -- | `O((n+m)*log(n+m))`, for n segments and m intersections.
- 155 -- Union of paths, removing overlap and rounding to the given tolerance.
- 156 union :: [ClosedPath Double] -> C.FillRule -> Double -> [ClosedPath Double]
- 157 union p fill tol = upCast (C.union (downCast p) fill tol)
- 158
- 159 -- | Find the intersections between two Bezier curves, using the Bezier Clip algorithm.
- 160 -- Returns the parameters for both curves.
- 161 bezierIntersection :: CubicBezier Double -> CubicBezier Double -> Double -> [(Double, Double)]
- 162 bezierIntersection a b t = C.bezierIntersection (downCast a) (downCast b) t
- 163
- 164 -- | Find the closest value on the bezier to the given point, within tolerance.
- 165 -- Return the first value found.
- 166 closest :: CubicBezier Double -> V2 Double -> Double -> Double
- 167 closest c p t = C.closest (downCast c) (downCast p) t
- 168
- 169 -- | Return the closed path as a list of curves.
- 170 closedPathCurves :: Fractional a => ClosedPath a -> [CubicBezier a]
- 171 closedPathCurves = upCast . C.closedPathCurves . downCast
- 172
- 173 -- | Return the open path as a list of curves.
- 174 openPathCurves :: Fractional a => OpenPath a -> [CubicBezier a]
- 175 openPathCurves = upCast . C.openPathCurves . downCast
- 176
- 177 -- | Make an open path from a list of curves. The last control point of each curve is ignored.
- 178 curvesToClosed :: [CubicBezier a] -> ClosedPath a
- 179 curvesToClosed = upCast . C.curvesToClosed . downCast
+ 154 -- | Find the parameter where the bezier curve is vertical.
+ 155 bezierVert :: CubicBezier Double -> [Double]
+ 156 bezierVert = C.bezierVert . downCast
+ 157
+ 158 -- | Create a normal path from a metapath.
+ 159 unmetaOpen :: OpenMetaPath Double -> OpenPath Double
+ 160 unmetaOpen = upCast . C.unmetaOpen . downCast
+ 161
+ 162 -- | Create a normal path from a metapath.
+ 163 unmetaClosed :: ClosedMetaPath Double -> ClosedPath Double
+ 164 unmetaClosed = upCast . C.unmetaClosed . downCast
+ 165
+ 166 -- | `O((n+m)*log(n+m))`, for n segments and m intersections.
+ 167 -- Union of paths, removing overlap and rounding to the given tolerance.
+ 168 union :: [ClosedPath Double] -> C.FillRule -> Double -> [ClosedPath Double]
+ 169 union p fill tol = upCast (C.union (downCast p) fill tol)
+ 170
+ 171 -- | Find the intersections between two Bezier curves, using the Bezier Clip algorithm.
+ 172 -- Returns the parameters for both curves.
+ 173 bezierIntersection :: CubicBezier Double -> CubicBezier Double -> Double -> [(Double, Double)]
+ 174 bezierIntersection a b t = C.bezierIntersection (downCast a) (downCast b) t
+ 175
+ 176 -- | Find the closest value on the bezier to the given point, within tolerance.
+ 177 -- Return the first value found.
+ 178 closest :: CubicBezier Double -> V2 Double -> Double -> Double
+ 179 closest c p t = C.closest (downCast c) (downCast p) t
180
- 181 -- | Interpolate between two vectors.
- 182 interpolateVector :: Num a => V2 a -> V2 a -> a -> V2 a
- 183 interpolateVector a b p = upCast $ C.interpolateVector (downCast a) (downCast b) p
+ 181 -- | Return the closed path as a list of curves.
+ 182 closedPathCurves :: Fractional a => ClosedPath a -> [CubicBezier a]
+ 183 closedPathCurves = upCast . C.closedPathCurves . downCast
184
- 185 -- | Distance between two vectors.
- 186 vectorDistance :: Floating a => V2 a -> V2 a -> a
- 187 vectorDistance a b = C.vectorDistance (downCast a) (downCast b)
+ 185 -- | Return the open path as a list of curves.
+ 186 openPathCurves :: Fractional a => OpenPath a -> [CubicBezier a]
+ 187 openPathCurves = upCast . C.openPathCurves . downCast
188
- 189 -- | Find inflection points on the curve.
- 190 findBezierInflection :: CubicBezier Double -> [Double]
- 191 findBezierInflection = C.findBezierInflection . downCast
+ 189 -- | Make an open path from a list of curves. The last control point of each curve is ignored.
+ 190 curvesToClosed :: [CubicBezier a] -> ClosedPath a
+ 191 curvesToClosed = upCast . C.curvesToClosed . downCast
192
- 193 -- | Find the cusps of a bezier.
- 194 findBezierCusp :: CubicBezier Double -> [Double]
- 195 findBezierCusp = C.findBezierCusp . downCast
+ 193 -- | Interpolate between two vectors.
+ 194 interpolateVector :: Num a => V2 a -> V2 a -> a -> V2 a
+ 195 interpolateVector a b p = upCast $ C.interpolateVector (downCast a) (downCast b) p
196
- 197 ------------------------------------------------------------
- 198 -- Instances
- 199
- 200 instance C.GenericBezier QuadBezier where
- 201 degree = C.degree . downCast
- 202 toVector = C.toVector . downCast
- 203 unsafeFromVector = upCast . C.unsafeFromVector
+ 197 -- | Distance between two vectors.
+ 198 vectorDistance :: Floating a => V2 a -> V2 a -> a
+ 199 vectorDistance a b = C.vectorDistance (downCast a) (downCast b)
+ 200
+ 201 -- | Find inflection points on the curve.
+ 202 findBezierInflection :: CubicBezier Double -> [Double]
+ 203 findBezierInflection = C.findBezierInflection . downCast
204
- 205 instance C.GenericBezier CubicBezier where
- 206 degree = C.degree . downCast
- 207 toVector = C.toVector . downCast
- 208 unsafeFromVector = upCast . C.unsafeFromVector
- 209
- 210 instance C.GenericBezier AnyBezier where
- 211 degree = C.degree . downCast
- 212 toVector = C.toVector . downCast
- 213 unsafeFromVector = upCast . C.unsafeFromVector
- 214
- 215 ------------------------------------------------------------
- 216 -- Casting
- 217
- 218 class Cast a b | a -> b, b -> a where
- 219 downCast :: a -> b
- 220 upCast :: b -> a
+ 205 -- | Find the cusps of a bezier.
+ 206 findBezierCusp :: CubicBezier Double -> [Double]
+ 207 findBezierCusp = C.findBezierCusp . downCast
+ 208
+ 209 ------------------------------------------------------------
+ 210 -- Instances
+ 211
+ 212 instance C.GenericBezier QuadBezier where
+ 213 degree = C.degree . downCast
+ 214 toVector = C.toVector . downCast
+ 215 unsafeFromVector = upCast . C.unsafeFromVector
+ 216
+ 217 instance C.GenericBezier CubicBezier where
+ 218 degree = C.degree . downCast
+ 219 toVector = C.toVector . downCast
+ 220 unsafeFromVector = upCast . C.unsafeFromVector
221
- 222 instance Cast a b => Cast [a] [b] where
- 223 downCast = map downCast
- 224 upCast = map upCast
- 225
- 226 instance (Cast a a', Cast b b') => Cast (a,b) (a',b') where
- 227 downCast (a, b) = (downCast a, downCast b)
- 228 upCast (a, b) = (upCast a, upCast b)
+ 222 instance C.GenericBezier AnyBezier where
+ 223 degree = C.degree . downCast
+ 224 toVector = C.toVector . downCast
+ 225 unsafeFromVector = upCast . C.unsafeFromVector
+ 226
+ 227 ------------------------------------------------------------
+ 228 -- Casting
229
- 230 instance Cast (V2 a) (C.Point a) where
- 231 downCast (V2 a b) = C.Point a b
- 232 upCast (C.Point a b) = V2 a b
+ 230 class Cast a b | a -> b, b -> a where
+ 231 downCast :: a -> b
+ 232 upCast :: b -> a
233
- 234 instance Cast (CubicBezier a) (C.CubicBezier a) where
- 235 downCast (CubicBezier a b c d) = C.CubicBezier
- 236 (downCast a) (downCast b) (downCast c) (downCast d)
- 237 upCast (C.CubicBezier a b c d) = CubicBezier
- 238 (upCast a) (upCast b) (upCast c) (upCast d)
- 239
- 240 instance Cast (QuadBezier a) (C.QuadBezier a) where
- 241 downCast (QuadBezier a b c) = C.QuadBezier
- 242 (downCast a) (downCast b) (downCast c)
- 243 upCast (C.QuadBezier a b c)= QuadBezier
- 244 (upCast a) (upCast b) (upCast c)
+ 234 instance Cast a b => Cast [a] [b] where
+ 235 downCast = map downCast
+ 236 upCast = map upCast
+ 237
+ 238 instance (Cast a a', Cast b b') => Cast (a,b) (a',b') where
+ 239 downCast (a, b) = (downCast a, downCast b)
+ 240 upCast (a, b) = (upCast a, upCast b)
+ 241
+ 242 instance Cast (V2 a) (C.Point a) where
+ 243 downCast (V2 a b) = C.Point a b
+ 244 upCast (C.Point a b) = V2 a b
245
- 246 instance V.Unbox a => Cast (AnyBezier a) (C.AnyBezier a) where
- 247 downCast (AnyBezier arr) = C.AnyBezier $
- 248 V.map (\(V2 a b) -> (a,b)) arr
- 249 upCast (C.AnyBezier arr) = AnyBezier $
- 250 V.map (\(a, b) -> V2 a b) arr
+ 246 instance Cast (CubicBezier a) (C.CubicBezier a) where
+ 247 downCast (CubicBezier a b c d) = C.CubicBezier
+ 248 (downCast a) (downCast b) (downCast c) (downCast d)
+ 249 upCast (C.CubicBezier a b c d) = CubicBezier
+ 250 (upCast a) (upCast b) (upCast c) (upCast d)
251
- 252 instance Cast (MetaNodeType a) (C.MetaNodeType a) where
- 253 downCast Open = C.Open
- 254 downCast (Curl gamma) = C.Curl gamma
- 255 downCast (Direction dir) = C.Direction (downCast dir)
- 256 upCast C.Open = Open
- 257 upCast (C.Curl gamma) = Curl gamma
- 258 upCast (C.Direction dir) = Direction (upCast dir)
- 259
- 260 instance Cast (MetaJoin a) (C.MetaJoin a) where
- 261 downCast (MetaJoin tyL tL tR tyR) = C.MetaJoin (downCast tyL) tL tR (downCast tyR)
- 262 downCast (Controls p1 p2) = C.Controls (downCast p1) (downCast p2)
- 263 upCast (C.MetaJoin tyL tL tR tyR) = MetaJoin (upCast tyL) tL tR (upCast tyR)
- 264 upCast (C.Controls p1 p2) = Controls (upCast p1) (upCast p2)
- 265
- 266 instance Cast (PathJoin a) (C.PathJoin a) where
- 267 downCast JoinLine = C.JoinLine
- 268 downCast (JoinCurve a b) = C.JoinCurve (downCast a) (downCast b)
- 269 upCast C.JoinLine = JoinLine
- 270 upCast (C.JoinCurve a b) = JoinCurve (upCast a) (upCast b)
+ 252 instance Cast (QuadBezier a) (C.QuadBezier a) where
+ 253 downCast (QuadBezier a b c) = C.QuadBezier
+ 254 (downCast a) (downCast b) (downCast c)
+ 255 upCast (C.QuadBezier a b c)= QuadBezier
+ 256 (upCast a) (upCast b) (upCast c)
+ 257
+ 258 instance V.Unbox a => Cast (AnyBezier a) (C.AnyBezier a) where
+ 259 downCast (AnyBezier arr) = C.AnyBezier $
+ 260 V.map (\(V2 a b) -> (a,b)) arr
+ 261 upCast (C.AnyBezier arr) = AnyBezier $
+ 262 V.map (\(a, b) -> V2 a b) arr
+ 263
+ 264 instance Cast (MetaNodeType a) (C.MetaNodeType a) where
+ 265 downCast Open = C.Open
+ 266 downCast (Curl gamma) = C.Curl gamma
+ 267 downCast (Direction dir) = C.Direction (downCast dir)
+ 268 upCast C.Open = Open
+ 269 upCast (C.Curl gamma) = Curl gamma
+ 270 upCast (C.Direction dir) = Direction (upCast dir)
271
- 272 instance Cast (OpenMetaPath a) (C.OpenMetaPath a) where
- 273 downCast (OpenMetaPath lst end) = C.OpenMetaPath
- 274 [ (downCast p, downCast j)
- 275 | (p, j) <- lst ] (downCast end)
- 276 upCast (C.OpenMetaPath lst end) = OpenMetaPath
- 277 [ (upCast p, upCast j)
- 278 | (p, j) <- lst ] (upCast end)
- 279
- 280 instance Cast (ClosedMetaPath a) (C.ClosedMetaPath a) where
- 281 downCast (ClosedMetaPath lst) = C.ClosedMetaPath
- 282 [ (downCast p, downCast j)
- 283 | (p, j) <- lst ]
- 284 upCast (C.ClosedMetaPath lst) = ClosedMetaPath
- 285 [ (upCast p, upCast j)
- 286 | (p, j) <- lst ]
- 287
- 288 instance Cast (OpenPath a) (C.OpenPath a) where
- 289 downCast (OpenPath lst end) = C.OpenPath
- 290 [ (downCast p, downCast j)
- 291 | (p, j) <- lst ] (downCast end)
- 292 upCast (C.OpenPath lst end) = OpenPath
- 293 [ (upCast p, upCast j)
- 294 | (p, j) <- lst ] (upCast end)
- 295
- 296 instance Cast (ClosedPath a) (C.ClosedPath a) where
- 297 downCast (ClosedPath lst) = C.ClosedPath
- 298 [ (downCast p, downCast j)
- 299 | (p, j) <- lst ]
- 300 upCast (C.ClosedPath lst) = ClosedPath
- 301 [ (upCast p, upCast j)
- 302 | (p, j) <- lst ]
+ 272 instance Cast (MetaJoin a) (C.MetaJoin a) where
+ 273 downCast (MetaJoin tyL tL tR tyR) = C.MetaJoin (downCast tyL) tL tR (downCast tyR)
+ 274 downCast (Controls p1 p2) = C.Controls (downCast p1) (downCast p2)
+ 275 upCast (C.MetaJoin tyL tL tR tyR) = MetaJoin (upCast tyL) tL tR (upCast tyR)
+ 276 upCast (C.Controls p1 p2) = Controls (upCast p1) (upCast p2)
+ 277
+ 278 instance Cast (PathJoin a) (C.PathJoin a) where
+ 279 downCast JoinLine = C.JoinLine
+ 280 downCast (JoinCurve a b) = C.JoinCurve (downCast a) (downCast b)
+ 281 upCast C.JoinLine = JoinLine
+ 282 upCast (C.JoinCurve a b) = JoinCurve (upCast a) (upCast b)
+ 283
+ 284 instance Cast (OpenMetaPath a) (C.OpenMetaPath a) where
+ 285 downCast (OpenMetaPath lst end) = C.OpenMetaPath
+ 286 [ (downCast p, downCast j)
+ 287 | (p, j) <- lst ] (downCast end)
+ 288 upCast (C.OpenMetaPath lst end) = OpenMetaPath
+ 289 [ (upCast p, upCast j)
+ 290 | (p, j) <- lst ] (upCast end)
+ 291
+ 292 instance Cast (ClosedMetaPath a) (C.ClosedMetaPath a) where
+ 293 downCast (ClosedMetaPath lst) = C.ClosedMetaPath
+ 294 [ (downCast p, downCast j)
+ 295 | (p, j) <- lst ]
+ 296 upCast (C.ClosedMetaPath lst) = ClosedMetaPath
+ 297 [ (upCast p, upCast j)
+ 298 | (p, j) <- lst ]
+ 299
+ 300 instance Cast (OpenPath a) (C.OpenPath a) where
+ 301 downCast (OpenPath lst end) = C.OpenPath
+ 302 [ (downCast p, downCast j)
+ 303 | (p, j) <- lst ] (downCast end)
+ 304 upCast (C.OpenPath lst end) = OpenPath
+ 305 [ (upCast p, upCast j)
+ 306 | (p, j) <- lst ] (upCast end)
+ 307
+ 308 instance Cast (ClosedPath a) (C.ClosedPath a) where
+ 309 downCast (ClosedPath lst) = C.ClosedPath
+ 310 [ (downCast p, downCast j)
+ 311 | (p, j) <- lst ]
+ 312 upCast (C.ClosedPath lst) = ClosedPath
+ 313 [ (upCast p, upCast j)
+ 314 | (p, j) <- lst ]