chaomodus / pyeuclid

Pyeuclid 2d/3d/matrix library. Github clone so we can maintain and enhance. [Automatically exported from code.google.com/p/pyeuclid]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intersection with Circle always includes end of LineSegment2

GoogleCodeExporter opened this issue · comments

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:

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

  • Added labels: ****
  • Removed labels: ****

Patch applied. Resolves both issues.