Fix bugs in zoning
This commit is contained in:
@@ -43,9 +43,11 @@ xIntercepts' :: Float -> Point2 -> Point2 -> [Point2]
|
||||
{-# INLINE xIntercepts' #-}
|
||||
xIntercepts' s (V2 sx sy) (V2 ex ey)
|
||||
| xdx == 0 = []
|
||||
| xdx > 0 = zipWith V2 [sx', sx' + xdx * 50 .. ex] ([sy', sy' + ydx * 50 .. ey] ++ repeat ey)
|
||||
| otherwise = zipWith V2 [sx' -50, sx' + xdx * 50 -50 .. ex -50] ([sy', sy' + ydx * 50 .. ey] ++ repeat ey)
|
||||
| otherwise = zipWith V2 [halfstep + sx', halfstep + sx' + xdx * s .. ex] ([sy', sy' + ydx * s .. ey] ++ repeat ey)
|
||||
where
|
||||
halfstep
|
||||
| xdx > 0 = -s/2
|
||||
| otherwise = s/2
|
||||
xdx = signum (ex - sx)
|
||||
ydx = (ey - sy) / abs (ex - sx) -- carefull: if this is zero
|
||||
sy' = sy + ydx * abs (sx - sx')
|
||||
|
||||
Reference in New Issue
Block a user