ghilesZ / geoml

A 2d geometry library for ocaml
GNU Lesser General Public License v2.1
35 stars 5 forks source link

Segment.intersection test incomplete? #10

Closed tbrup closed 4 years ago

tbrup commented 4 years ago

While solving Euler-project problem 165 I used geoml. It seems to me that the code in Segment.intersection is incomplete, as it only checks that the intersection is within (a1,b1). It should also check that p is between (a2,b2). Same applies to Segment.intersects.

I assume it is not an oversight, that Segment.intersects and Segment.intersection have different criteria ('<' vs '<='), since Segment.intersection returns true intersections (a1,b1) whereas Segment.intersects also returns true if the intersection is one of the end-points [a1,b1].

ghilesZ commented 4 years ago

I have merged your first commit (and not the second). However, feel free to add an issue concerning the behaviour of float comparison