Refactor wall points from lists to pairs
This commit is contained in:
@@ -34,21 +34,24 @@ putLineBlock basePane blockWidth depth a b w = removePathsCrossing a b $ foldr i
|
||||
blockCenPs = snd $ evenOddSplit psOnLine
|
||||
numBlocks = length blockCenPs
|
||||
is = [0.. numBlocks - 1]
|
||||
cornerPoints = [(-halfBlockWidth,-depth) -- goes anticlockwise around the block
|
||||
,(-halfBlockWidth, depth)
|
||||
,( halfBlockWidth, depth)
|
||||
,( halfBlockWidth,-depth)
|
||||
]
|
||||
cornerPoints =
|
||||
[(-halfBlockWidth,-depth) -- goes anticlockwise around the block
|
||||
,(-halfBlockWidth, depth)
|
||||
,( halfBlockWidth, depth)
|
||||
,( halfBlockWidth,-depth)
|
||||
]
|
||||
cornersAt p = fmap ( (p +.+) . rotateV rot) cornerPoints
|
||||
linesAt p = map (\(a,b) -> [a,b]) $ makeLoopPairs $ cornersAt p
|
||||
linesAt p = map (\(a,b) -> (a,b)) $ makeLoopPairs $ cornersAt p
|
||||
k = newKey $ _walls w
|
||||
ksAtI i = map ( + (k + i*4) ) [0,1,2,3]
|
||||
visibilityAt i | i == 0 = [ True,True,False,True]
|
||||
| i == numBlocks - 1 = [False,True, True,True]
|
||||
| otherwise = [False,True,False,True]
|
||||
shadowsAt i | i == 0 = ksAtI 1
|
||||
| i == numBlocks - 1 = ksAtI $ numBlocks - 2
|
||||
| otherwise = ksAtI (i-1) ++ ksAtI (i+1)
|
||||
visibilityAt i
|
||||
| i == 0 = [ True,True,False,True]
|
||||
| i == numBlocks - 1 = [False,True, True,True]
|
||||
| otherwise = [False,True,False,True]
|
||||
shadowsAt i
|
||||
| i == 0 = ksAtI 1
|
||||
| i == numBlocks - 1 = ksAtI $ numBlocks - 2
|
||||
| otherwise = ksAtI (i-1) ++ ksAtI (i+1)
|
||||
makeBlockAt :: Point2 -> Int -> [Wall]
|
||||
makeBlockAt p i = zipWith3 (makePane i) (visibilityAt i) (ksAtI i) (linesAt p)
|
||||
makePane i visStatus k' ps
|
||||
|
||||
Reference in New Issue
Block a user