Refactoring
This commit is contained in:
+16
-6
@@ -23,9 +23,19 @@ vvThickLine = lineOfThickness 6
|
||||
-- shit this is ugly
|
||||
lineOfThickness :: Float -> [Point2] -> Picture
|
||||
lineOfThickness t = pictures . f
|
||||
where f (x:y:ys)
|
||||
| x == y = f (x:ys)
|
||||
| otherwise
|
||||
= polygon [x +.+ n x y, x -.- n x y, y -.- n x y, y +.+ n x y] : f (y:ys)
|
||||
f _ = []
|
||||
n a b = (t*0.5) *.* errorNormalizeV 42 (vNormal (a -.- b))
|
||||
where
|
||||
f (x:y:ys)
|
||||
| x == y = f (x:ys)
|
||||
| otherwise = polygon [x +.+ n x y, x -.- n x y, y -.- n x y, y +.+ n x y] : f (y:ys)
|
||||
f _ = []
|
||||
n a b = (t*0.5) *.* errorNormalizeV 42 (vNormal (a -.- b))
|
||||
|
||||
wedgeOfThickness :: Float -> Point2 -> Point2 -> Picture
|
||||
wedgeOfThickness t x y
|
||||
| x == y = blank
|
||||
| otherwise = pictures
|
||||
[uncurry translate x $ circleSolid (0.5*t)
|
||||
,polygon [x +.+ n x y, x -.- n x y, y]
|
||||
]
|
||||
where
|
||||
n a b = (t*0.5) *.* errorNormalizeV 4200 (vNormal (a -.- b))
|
||||
|
||||
Reference in New Issue
Block a user