xocoatzin / pyeuclid

Automatically exported from code.google.com/p/pyeuclid
0 stars 0 forks source link

Intersection with Circle always includes end of LineSegment2 #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using r36:

>>> from euclid import Circle, LineSegment2
>>> c = Circle(Point2(0.0, 0.0), 1.0)
>>> s = LineSegment2(Point2(-4.0, 0.0), Point2(-3.0, 0.0))
>>> s.intersect(c)
Point2(-3.00, 0.00)

Expected value is 'None' since segment does not intersect circle.

I attach suggested patch which fixes the issue (and seems not to introduce new 
ones, though is not fully tested).

Original issue reported on code.google.com by e.zagoro...@gmail.com on 7 Jun 2011 at 2:11

Attachments:

GoogleCodeExporter commented 9 years ago
I have a similar issue with a Ray2, probably caused by the same underlying code:

>>> c = Circle(Point2(4,5), 1.0)
>>> r = Ray2(Point2(13.0, 5.0), Vector2(1.0, 0.0))
>>> r.intersect(c)
Point2(13.00, 5.00)

Original comment by morte...@ifi.uio.no on 15 Jul 2014 at 7:15