You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
surpriseMePolygon and createRegularPolygon returns invalid polygon where three or more points having same value due to type casting from double to float.
Version and environment details
No response
The text was updated successfully, but these errors were encountered:
What happens with createRegularPolygon is very interesting. The smaller the polygon's radius is and the more vertices it has, the smaller the sides are. At some point they get so small, they can't fit on a float. I opened a PR which should fix the issue.
For surpriseMePolygon, the problem appears when we have a center with large coordinates and a small radius. The radius is too small to register when doing arithmetic with the center's coordinates. I added a retry mechanism.
There are other problems that I have to think about more, maybe in a separate PR. For example, what about large coordinates for createRegularPolygon? What about the case when the centers are at FLOAT_MAX? Then the radius becomes 0.
Another edge case that can cause problems is that of multiple points on the same line (e.g. 3 points in a row with the same x coordinate). This happens for regular and for "surprise" polygons.
Description
https://github.com/apache/lucene/blob/main/lucene/test-framework/src/java/org/apache/lucene/tests/geo/ShapeTestUtil.java
surpriseMePolygon and createRegularPolygon returns invalid polygon where three or more points having same value due to type casting from double to float.
Version and environment details
No response
The text was updated successfully, but these errors were encountered: