kld-intersections icon indicating copy to clipboard operation
kld-intersections copied to clipboard

Intersection inside rectangle reports "No intersection"

Open marcospassos opened this issue 6 years ago • 2 comments

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 avatar Sep 14 '17 17:09 marcospassos

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.

thelonious avatar Sep 30 '17 19:09 thelonious

@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.

ajbogh avatar Nov 26 '18 19:11 ajbogh