Files
loop/src/Dodge/Render/Connectors.hs
T

43 lines
996 B
Haskell

module Dodge.Render.Connectors
( zConnect
, zConnectCol
, bConnect
, lConnect
) where
import Picture
import Geometry
zConnect :: Point2 -> Point2 -> Picture
zConnect (V2 x y) (V2 a b) = line $ map toV2
[(x,y)
,(0.5 * (x+a), y)
,(0.5 * (x+a), b)
,(a, b)
]
zConnectCol :: Point2 -> Point2 -> Color -> Color -> Color -> Color -> Picture
zConnectCol (V2 x y) (V2 a b) c1 c2 c3 c4 = lineCol $ zip
( map toV2
[(x,y)
,(0.5 * (x+a), y)
,(0.5 * (x+a), b)
,(a, b)
]
) [c1,c2,c3,c4]
bConnect :: Point2 -> Point2 -> Picture
bConnect (V2 x y) (V2 z w) = pictures
[ bline 0.2 0.050 0.010
, bline 0.5 0.045 0.005
, bline 0.5 0.035 0.002
] --cheapo antialiasing
where
bline alph lwidth rwidth
= bezierQuad (withAlpha 0.0 white) (withAlpha alph white) lwidth rwidth (V2 x y) (V2 0 y) (V2 z w)
lConnect :: Point2 -> Point2 -> Picture
lConnect sp@(V2 _ y) ep@(V2 x _) = line
[ sp
, V2 x y
, ep
]