Replace buggy circle seg intersection with a simpler test
This commit is contained in:
@@ -300,6 +300,7 @@ inSegArea a b c = param >= 0 && param <= dotV (b -.- a) (b -.- a)
|
||||
where
|
||||
param = dotV (b -.- a) (c -.- a)
|
||||
|
||||
-- I suspect that this may not be correct...
|
||||
intersectCircSeg :: Point2 -> Float -> Point2 -> Point2 -> [Point2]
|
||||
intersectCircSeg c r a b
|
||||
| y < 0 = []
|
||||
@@ -311,5 +312,12 @@ intersectCircSeg c r a b
|
||||
z = sqrt y
|
||||
v = z *.* normalizeV (b -.- a)
|
||||
|
||||
intersectCircSegTest :: Point2 -> Float -> Point2 -> Point2 -> Bool
|
||||
intersectCircSegTest c r x y = intersectSegSegTest (c + z) (c - z) x y
|
||||
|| dist c x <= r
|
||||
|| dist c y <= r
|
||||
where
|
||||
z = r *.* vNormal (normalizeV x - y)
|
||||
|
||||
intersectCircSegFirst :: Point2 -> Float -> Point2 -> Point2 -> Maybe Point2
|
||||
intersectCircSegFirst c r a = listToMaybe . intersectCircSeg c r a
|
||||
|
||||
Reference in New Issue
Block a user