-
Notifications
You must be signed in to change notification settings - Fork 32
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
Problem with point inside intersections polygon #189
Comments
This problem seems to come from the precision of the calculation of the inside point in function. polygon._find_new_inside returns a point which then in graph.intersection is detected as outside of the polygon and the function polygon.invert_polygon() is called to turn around the polygon. As solution to this problem of precision in the calculation of the inside point can be to take the mean of all candidates. It can be achieved with this piece of code in polygon._find_new_inside :
The example given above now works flawlessly. |
3 years too late but are you interested in opening a PR? 😸 |
I do not believe there is an issue with "precision" of computations. I may be wrong, but it seems to me that the polygon is self-intersecting and, to the best of my understanding (@pllim please correct me), self-intersecting polygons are not supported. Even if self-intersecting polygons are supported, proposed fix works simply because of a lucky set of points. It may work for this particular set of points and it will fail for another set. I would not recommend making a PR to implement proposed "fix". |
I don't remember what is and is not supported here. Though generally speaking if something isn't supported, we should prevent it from being created in the first place, or throw a meaningful error later during computation if the former isn't possible. Or if neither of those are possible, then document it clearly in the docs. What do you think? |
Nice to see that this issue is being worked on ! |
I never knew (== I am not the original developer) what is and is not supported here. However, I do not believe self-intersecting polygons are supported. You will need to split them into independent polygons and form a union. Here is how @JanPolcher's polygon looks when projected to a tangent plane perpendicular to a middle point (vector) of points 1-6: It is also possible I am doing something wrong so please correct me if you get a different image of your polygon. |
How?
Feel free to make a PR for this.
That is doable (==something even I can do). |
Theoretically, we could check if any of the lines intersect each other but my math is real rusty now. |
On a plane - yes. On a sphere, math is more complicated and time consuming. Performance is an important consideration. |
In that case, doc would be a reasonable solution for now. |
OK, and I need to check in my code which produces the intersecting polygone. It should be the result of the intersects_poly function. But that is already 3 years ago and I do not know if we did not solve it differently. |
Yes, performance in Spherical Geometry is super important ! |
It looks like self-intersecting polygons should be supported. See #131 |
Hello,
When computing the overlap area of two polygons I some times find values which are far too large.
I could show that when increasing the number of points defining one of the polygons, then suddenly the overlap area becomes correct.
It turns out, that it is when the location of the center of the intersecting polygon is outside both original polygons (and thus also of the intersection) things go wrong.
Below is a simple piece of code which demonstrates the issues. It also displays the two polygons to show that as we change the number of points defining.
The output of this code :
The text was updated successfully, but these errors were encountered: