Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LineSegment Circle intersection #145

Open
grav2itty opened this issue Jul 10, 2021 · 1 comment
Open

LineSegment Circle intersection #145

grav2itty opened this issue Jul 10, 2021 · 1 comment

Comments

@grav2itty
Copy link

Hi.
Im trying to do some intersections.

45> circle = Ball.Circle (ext $ Point2 0 0) (1::Double)
46> segment r x = LineSegment (Closed . ext $ (Point2 0 0)) (Closed . ext $ (Point2 (r * cos x) (r * sin x)))
47> Data.Intersection.intersect (segment 1.0 (0.1::Double)) circle
{|Point2 0.9950041652780258 9.983341664682815e-2|}
48> Data.Intersection.intersect (segment 1.1 (0.1::Double)) circle
{|NoIntersection|}
49> Data.Intersection.intersect (segment 1.2 (0.1::Double)) circle
{|NoIntersection|}
50> Data.Intersection.intersect (segment 1.4 (0.1::Double)) circle
{|Point2 0.9950041652780258 9.983341664682815e-2|}
51> Data.Intersection.intersect (segment 1.5 (0.1::Double)) circle
{|Point2 0.9950041652780258 9.983341664682815e-2|}
52> Data.Intersection.intersect (segment 1.6 (0.1::Double)) circle
{|NoIntersection|}

@noinia
Copy link
Owner

noinia commented Oct 26, 2021

Hey there, Thanks for reporting this, and sorry for my (incredibly) late reply.

I think this is some sort of floating point issue. The recent PR (#147) in which we've separated testing for intersections from computing the exact location of the intersections should partially address this; i.e. testing if the segment intersects the circle should now be more robust. Computing its intersection points are probably still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants