Work on chasm rooms
This commit is contained in:
@@ -15,9 +15,9 @@ import Linear.Metric
|
||||
import Control.Monad
|
||||
|
||||
-- | If two lines intersect, return 'Just' that point.
|
||||
intersectLineLine' :: Point2 -> Point2 -> Point2 -> Point2 -> Maybe Point2
|
||||
{-# INLINE intersectLineLine' #-}
|
||||
intersectLineLine' (V2 x1 y1) (V2 x2 y2) (V2 x3 y3) (V2 x4 y4)
|
||||
intersectLineLine :: Point2 -> Point2 -> Point2 -> Point2 -> Maybe Point2
|
||||
{-# INLINE intersectLineLine #-}
|
||||
intersectLineLine (V2 x1 y1) (V2 x2 y2) (V2 x3 y3) (V2 x4 y4)
|
||||
| den == 0 = Nothing
|
||||
| otherwise = Just $ V2 (x1 + (x2 - x1) * t' / den) (y1 + (y2 - y1) * t' / den)
|
||||
where
|
||||
@@ -28,7 +28,7 @@ intersectLineLine' (V2 x1 y1) (V2 x2 y2) (V2 x3 y3) (V2 x4 y4)
|
||||
intersectLinePlane :: Point3 -> Point3 -> Point3 -> Point3 -> Maybe Point3
|
||||
intersectLinePlane l v p n = case dot v n of
|
||||
0 -> Nothing
|
||||
x -> Just $ l + ((dot (p - l) n) / x) *.*.* v
|
||||
x -> Just $ l + (dot (p - l) n / x) *.*.* v
|
||||
|
||||
-- this needs to be checked
|
||||
intersectSegPlane :: Point3 -> Point3 -> Point3 -> Point3 -> Maybe Point3
|
||||
|
||||
Reference in New Issue
Block a user