DIAG: be more consistent about Diag constructor parameter naming
This commit is contained in:
parent
70a6dd1766
commit
8abe795add
@ -19,32 +19,32 @@ import Parser.PathParser
|
|||||||
|
|
||||||
-- |Draw the lines of the polygon.
|
-- |Draw the lines of the polygon.
|
||||||
polyLines :: Diag
|
polyLines :: Diag
|
||||||
polyLines = Diag pp
|
polyLines = Diag f
|
||||||
where
|
where
|
||||||
pp _ [] = mempty
|
f _ [] = mempty
|
||||||
pp _ (x:y:_) =
|
f _ (x:y:_) =
|
||||||
strokePoly x <> strokePoly y
|
strokePoly x <> strokePoly y
|
||||||
where
|
where
|
||||||
strokePoly x' = (strokeTrail . fromVertices $ x' ++ [head x'])
|
strokePoly x' = (strokeTrail . fromVertices $ x' ++ [head x'])
|
||||||
# moveTo (head x') # lc black
|
# moveTo (head x') # lc black
|
||||||
pp _ _ = mempty
|
f _ _ = mempty
|
||||||
|
|
||||||
|
|
||||||
-- |Show the intersection points of two polygons as red dots.
|
-- |Show the intersection points of two polygons as red dots.
|
||||||
polyIntersection :: Diag
|
polyIntersection :: Diag
|
||||||
polyIntersection = Diag pi'
|
polyIntersection = Diag f
|
||||||
where
|
where
|
||||||
pi' p (x:y:_) = drawP vtpi (dotSize p) # fc red # lc red
|
f p (x:y:_) = drawP vtpi (dotSize p) # fc red # lc red
|
||||||
where
|
where
|
||||||
vtpi = intersectionPoints . sortLexPolys $ (sortLexPoly x, sortLexPoly y)
|
vtpi = intersectionPoints . sortLexPolys $ (sortLexPoly x, sortLexPoly y)
|
||||||
pi' _ _ = mempty
|
f _ _ = mempty
|
||||||
|
|
||||||
|
|
||||||
-- |Show the coordinate text of the intersection points of two polygons.
|
-- |Show the coordinate text of the intersection points of two polygons.
|
||||||
polyIntersectionText :: Diag
|
polyIntersectionText :: Diag
|
||||||
polyIntersectionText = Diag pit'
|
polyIntersectionText = Diag f
|
||||||
where
|
where
|
||||||
pit' p (x:y:_)
|
f p (x:y:_)
|
||||||
| showCoordText p = position . zip vtpi $ (pointToTextCoord # fc red <$> vtpi)
|
| showCoordText p = position . zip vtpi $ (pointToTextCoord # fc red <$> vtpi)
|
||||||
# translate (r2 (0, 10))
|
# translate (r2 (0, 10))
|
||||||
| otherwise = mempty
|
| otherwise = mempty
|
||||||
@ -53,48 +53,48 @@ polyIntersectionText = Diag pit'
|
|||||||
. sortLexPolys
|
. sortLexPolys
|
||||||
$ (sortLexPoly x,
|
$ (sortLexPoly x,
|
||||||
sortLexPoly y)
|
sortLexPoly y)
|
||||||
pit' _ _ = mempty
|
f _ _ = mempty
|
||||||
|
|
||||||
|
|
||||||
-- |Create a diagram which shows the points of the convex hull.
|
-- |Create a diagram which shows the points of the convex hull.
|
||||||
convexHP :: Diag
|
convexHP :: Diag
|
||||||
convexHP = Diag chp
|
convexHP = Diag f
|
||||||
where
|
where
|
||||||
chp p [vt] = drawP (grahamCH vt) (dotSize p) # fc red # lc red
|
f p [vt] = drawP (grahamCH vt) (dotSize p) # fc red # lc red
|
||||||
chp _ _ = mempty
|
f _ _ = mempty
|
||||||
|
|
||||||
|
|
||||||
-- |Show coordinates as text above the convex hull points.
|
-- |Show coordinates as text above the convex hull points.
|
||||||
convexHPText :: Diag
|
convexHPText :: Diag
|
||||||
convexHPText = Diag chpt
|
convexHPText = Diag f
|
||||||
where
|
where
|
||||||
chpt p [vt]
|
f p [vt]
|
||||||
| showCoordText p =
|
| showCoordText p =
|
||||||
position $ zip vtchf (pointToTextCoord <$> vtchf) # translate (r2 (0, 10))
|
position $ zip vtchf (pointToTextCoord <$> vtchf) # translate (r2 (0, 10))
|
||||||
| otherwise = mempty
|
| otherwise = mempty
|
||||||
where
|
where
|
||||||
vtchf = grahamCH vt
|
vtchf = grahamCH vt
|
||||||
chpt _ _ = mempty
|
f _ _ = mempty
|
||||||
|
|
||||||
|
|
||||||
-- |Create a diagram which shows the lines along the convex hull
|
-- |Create a diagram which shows the lines along the convex hull
|
||||||
-- points.
|
-- points.
|
||||||
convexHLs :: Diag
|
convexHLs :: Diag
|
||||||
convexHLs = Diag chl
|
convexHLs = Diag f
|
||||||
where
|
where
|
||||||
chl _ [vt] =
|
f _ [vt] =
|
||||||
(strokeTrail . fromVertices . flip (++) [head $ grahamCH vt] . grahamCH $ vt)
|
(strokeTrail . fromVertices . flip (++) [head $ grahamCH vt] . grahamCH $ vt)
|
||||||
# moveTo (head $ grahamCH vt) # lc red
|
# moveTo (head $ grahamCH vt) # lc red
|
||||||
chl _ _ = mempty
|
f _ _ = mempty
|
||||||
|
|
||||||
|
|
||||||
-- |Create list of diagrama which describe the lines along points of a half
|
-- |Create list of diagrama which describe the lines along points of a half
|
||||||
-- convex hull, for each iteration of the algorithm. Which half is chosen
|
-- convex hull, for each iteration of the algorithm. Which half is chosen
|
||||||
-- depends on the input.
|
-- depends on the input.
|
||||||
convexHStepsLs :: Diag
|
convexHStepsLs :: Diag
|
||||||
convexHStepsLs = GifDiag chs
|
convexHStepsLs = GifDiag f
|
||||||
where
|
where
|
||||||
chs _ col f vt = fmap mkChDiag (f vt)
|
f _ col g vt = fmap mkChDiag (g vt)
|
||||||
where
|
where
|
||||||
mkChDiag vt' = (strokeTrail . fromVertices $ vt') # moveTo (head vt') # lc col
|
mkChDiag vt' = (strokeTrail . fromVertices $ vt') # moveTo (head vt') # lc col
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@ import Graphics.Diagram.Core
|
|||||||
-- as dots. The points and thickness of the dots can be controlled
|
-- as dots. The points and thickness of the dots can be controlled
|
||||||
-- via DiagProp.
|
-- via DiagProp.
|
||||||
coordPoints :: Diag
|
coordPoints :: Diag
|
||||||
coordPoints = Diag cp
|
coordPoints = Diag f
|
||||||
where
|
where
|
||||||
cp _ [] = mempty
|
f _ [] = mempty
|
||||||
cp p [vt] = drawP vt (dotSize p) # fc black # lc black
|
f p [vt] = drawP vt (dotSize p) # fc black # lc black
|
||||||
cp p vts = drawP (concat vts) (dotSize p) # fc black # lc black
|
f p vts = drawP (concat vts) (dotSize p) # fc black # lc black
|
||||||
|
|
||||||
|
|
||||||
-- |Show coordinates as text above all points.
|
-- |Show coordinates as text above all points.
|
||||||
|
Loading…
Reference in New Issue
Block a user