32 lines
994 B
Haskell
32 lines
994 B
Haskell
{- |
|
|
Compound, universal pictures.
|
|
Creates uniform sizes and commands for the Dodge modules. -}
|
|
module Dodge.Picture
|
|
where
|
|
import Geometry
|
|
import Picture
|
|
|
|
wedgeOfThickness :: Float -> Point2 -> Point2 -> Picture
|
|
wedgeOfThickness t x y
|
|
| x == y = blank
|
|
| otherwise = pictures
|
|
[uncurryV 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))
|
|
|
|
verticalPipe :: Float -> Color -> Point2 -> Float -> Float -> Picture
|
|
verticalPipe w col (V2 xx xy) za zb = pictures $ map (poly3Col . f) ps
|
|
where
|
|
x = V3 xx xy 0
|
|
xs = map ((\(V2 a b) -> x +.+.+ V3 a b za) . toV2) [(w,0),(0,w),(-w,0),(0,-w)]
|
|
ps = zip xs (tail xs ++ [head xs])
|
|
f (a,b) = map f' [a,b,g b,g a]
|
|
g :: Point3 -> Point3
|
|
g (V3 a b _) = V3 a b zb
|
|
f' a = (a,col)
|
|
|
|
expandLine :: Point3 -> Point3 -> Point3 -> [Point3]
|
|
expandLine v x y = [x -.-.- v, y -.-.- v, y +.+.+ v, x +.+.+ v]
|