[geos-devel] SnapPointToLine : GEOS : where is the code for st_intersects between line and point?

Rémi Cura remi.cura at gmail.com
Fri Nov 8 08:29:34 PST 2013


Hey,
at first sight it seems to work =)
Yet I don't know how to be sure of it.

"for example : http://hpics.li/ccf7b74
(we construct 2 points at double_precision/2 distance on perpendicular
line. If the 2 points have different side OR at least one is on line, we
say the point is on the line).
I'm not sure about this though because I don't know how the perpendicular
construction will react in bad cases, I'll test this this in few hours."

still need some care, and i'm afraid my c code is very far from efficient
(or even nice).

What could be a testing strategy?
_I intend to test st_intersects vs the result of "st_closestpoint" and
 "ST_Line_Interpolate_Point", the test being that it should always
intersect.
_I can try to generate maybe 300*300 points at the geometry precision limit
and try to see which one are on the line.

_as the change is small, maybe we can see if this passes the usual
st_intersect test?

I'm full of good will but with rusty C skills.

Cheers,
Rémi-C





2013/11/8 Sandro Santilli <strk at keybit.net>

> On Fri, Nov 08, 2013 at 01:01:56PM +0100, Rémi Cura wrote:
>
> > "Are you saying you have a point and a line and you can mathematically
> > prove that the point is on the line while GEOS says otherwise ?"
> > Yep, it's all the problem ! in fact according to geos (st_intersect)
> lines
> > have *very* few points, and some line have no points except extremities !
>
> You mean they have no _representable_ points.
> You're right you can mathematically represent them,
> only not in floating point notation.
>
> > AS I said the
> > spacing of the point found bi st_intersects seems to follow the
> > prime decomposition of the slope (or 1/slope) of the segment. Problem
> > occurs when slope is not a finite number.
> >
> > The whole problem comes from using exact math formula with inexact
> > computations means. This has been somehow tackled by using a "robust"
> > determinant sign, unfortunately this robustness is about saying left or
> > right.
> >
> > :-) Thanks for the typs about DEBUG, I'll try to find this , and also the
> > place where postgres store it's log.
> >
> > Many thanks for your patience with a beginner like me ^^
>
> Thank you for going deep into this !
>
> --strk;
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20131108/82a7f1a8/attachment.html>


More information about the geos-devel mailing list