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

Intersection inside rectangle reports "No intersection" #18

Open
marcospassos opened this issue Sep 14, 2017 · 2 comments
Open

Intersection inside rectangle reports "No intersection" #18

marcospassos opened this issue Sep 14, 2017 · 2 comments

Comments

@marcospassos
Copy link

When a point is inside a circle, the resulting status is "Inside". However, when a shape is inside a rectangle the resulting status is "No Intersection".

@marcospassos marcospassos changed the title Intersection inside rectangle reports no intersection Intersection inside rectangle reports "No intersection" Sep 14, 2017
@thelonious
Copy link
Owner

thelonious commented Sep 30, 2017

Hi @marcospassos,

Yeah, that functionality is really a remnant of when this code was first written for kevlindev.com. I would show status live as the user manipulated items in the UI. When I moved this code over to github, I wanted those examples to use the same code and not be broken. Really, I should remove the whole concept of "status" from the intersection algorithms and move those to queries.

As a workaround, you check if each point in your shape is within the rectangle. You would have to convert the rectangle to a polygon, then check if each point of your first shape is within the polygon. Of course, this assumes you are checking polys against the rectangle.

@ajbogh
Copy link

ajbogh commented Nov 26, 2018

@marcospassos Could you follow up the rectangle status of "No intersection" by drawing a circle which is the same diameter of the rectangle and testing the shape against that? If the shape says "Inside" the circle, then it's likely inside the rectangle as well. For better accuracy you could use an ellipse instead of a circle to mimic the rectangular shape, assuming ellipses give an "Inside" value as well.

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

3 participants