Remove old code
This commit is contained in:
@@ -23,20 +23,6 @@ intersectLineLine a b c d = do
|
||||
guard $ den /= 0
|
||||
let t = detV (a-c) (c-d)
|
||||
return $ a + (t/den) *^ (b-a)
|
||||
-- | den == 0 = Nothing
|
||||
-- | otherwise = Just $ a + (t/den) *^ (b - a)
|
||||
---- | otherwise = Just $ V2 (x1 + (x2 - x1) * t / den) (y1 + (y2 - y1) * t / den)
|
||||
-- where
|
||||
-- den = detV (a-b) (c-d)
|
||||
---- den = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4)
|
||||
-- t = detV (a-c) (c-d) --x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)
|
||||
---- t = (x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)
|
||||
|
||||
---- note that the second argument is a vector, not the second point of the line
|
||||
--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
|
||||
|
||||
intersectLinePlaneAlong :: Point3 -> Point3 -> Point3 -> Point3 -> Maybe Float
|
||||
intersectLinePlaneAlong x y p n = do
|
||||
@@ -50,13 +36,6 @@ intersectSegPlane x y p n = do
|
||||
d <- intersectLinePlaneAlong x y p n
|
||||
guard $ d >= 0 && d < 1
|
||||
return $ x + d *^ (y - x)
|
||||
--case dot v n of
|
||||
-- 0 -> Nothing
|
||||
-- x -> case dot (p - sp) n / x of
|
||||
-- d | d >= 0 && d <= 1 -> Just $ sp + d *.*.* v
|
||||
-- _ -> Nothing
|
||||
-- where
|
||||
-- v = ep - sp
|
||||
|
||||
intersectSegSurface ::
|
||||
Point3 ->
|
||||
@@ -124,21 +103,6 @@ intersectSegRay (V2 x1 y1) (V2 x2 y2) (V2 x3 y3) (V2 x4 y4)
|
||||
t' = (x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)
|
||||
u' = (y1 - y2) * (x1 - x3) - (x1 - x2) * (y1 - y3)
|
||||
|
||||
---- | Similar to 'intersectSegLineFrom'', but this version is probably not correct...
|
||||
--intersectSegLineext :: Point2 -> Point2 -> Point2 -> Point2 -> Maybe Point2
|
||||
--{-# INLINE intersectSegLineext #-}
|
||||
--intersectSegLineext (V2 x1 y1) (V2 x2 y2) (V2 x3 y3) (V2 x4 y4)
|
||||
-- | den == 0 = Nothing
|
||||
-- | den > 0 && (t' < 0 || u' < den || t' > den) =
|
||||
-- Nothing
|
||||
-- | den < 0 && (t' > 0 || u' > - den || t' < den) =
|
||||
-- Nothing
|
||||
-- | otherwise = Just $ V2 (x1 + (x2 - x1) * t' / den) (y1 + (y2 - y1) * t' / den)
|
||||
-- where
|
||||
-- den = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4)
|
||||
-- t' = (x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)
|
||||
-- u' = (y1 - y2) * (x1 - x3) - (x1 - x2) * (y1 - y3)
|
||||
|
||||
{- | Intersect a segment with a line.
|
||||
the line intersects with the first endpoint of the segment
|
||||
but NOT the second
|
||||
@@ -156,8 +120,6 @@ intersectSegLine (V2 x1 y1) (V2 x2 y2) (V2 x3 y3) (V2 x4 y4)
|
||||
den = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4)
|
||||
t = (x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)
|
||||
|
||||
--u' = (y1-y2)*(x1-x3) - (x1-x2)*(y1-y3)
|
||||
|
||||
-- | A test that should align with Just values from intersectSegSeg.
|
||||
intersectSegSegFullTest ::
|
||||
Point2 ->
|
||||
|
||||
Reference in New Issue
Block a user