postgrespro / pgsphere

PgSphere provides spherical data types, functions, operators, and indexing for PostgreSQL.
https://pgsphere.org
BSD 3-Clause "New" or "Revised" License
16 stars 15 forks source link

spherepoly_check (sline_sline_pos) is not working properly #35

Closed ggnmstr closed 10 months ago

ggnmstr commented 11 months ago

Current state of spherepoly_check allows user to create polygons like spoly'{(0d,1d),(0d,2d),(0d,3d)}', which is incorrect because all points lie on the same meridian. The root of this problem may be in sline_sline_pos fucntion, because it determines relations between sline'(0d,1d),(0d,2d)' and sline'(0d,3d),(0d,1d)' as "connects", which is also incorrect.

Screenshot from 2023-07-29 15-23-52 2 last log messages: pos=5 means lines are connected, but they actually overlap.

Solution I found is to change the order of block of code in sline_sline_pos responsible for detecting overlap and connection. I created pull request with that fix.