HGeometry is a library for computing with geometric objects in Haskell. It defines basic geometric types and primitives, and it implements some geometric data structures and algorithms.
121
stars
40
forks
source link
sqDistanceToSegArg errors when result should be an open endpoint #170
Howdy. As per the title, there's an issue with LineSegment's sqDistanceToSegArg shown by the following code.
let ls = OpenLineSegment (Point2 0 0 :+ ()) (Point2 1 0 :+ ())
p = Point2 2 0
in snd (sqDistanceToSegArg p ls) == Point2 1 0
This should return True as per the documentation
Note that if the segment is open, the closest point
returned may be one of the (open) end points, even though technically the
end point does not lie on the segment. (The true closest point then lies
arbitrarily close to the end point).
Instead it throws Prelude.foldl1: empty list. This is because although the implementation (correctly) adds the endpoints as candidates it, incorrectly, filters them out as not on the list.
Howdy. As per the title, there's an issue with
LineSegment
'ssqDistanceToSegArg
shown by the following code.This should return
True
as per the documentationInstead it throws
Prelude.foldl1: empty list
. This is because although the implementation (correctly) adds the endpoints as candidates it, incorrectly, filters them out as not on the list.