[postgis-devel] [PostGIS] #272: ST_LineCrossingDirection should be negatively symmetric
PostGIS
trac at osgeo.org
Sat Oct 17 00:12:31 PDT 2009
#272: ST_LineCrossingDirection should be negatively symmetric
----------------------+-----------------------------------------------------
Reporter: robe | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: postgis 1.4.1
Component: postgis | Version: 1.4.X
Resolution: | Keywords:
----------------------+-----------------------------------------------------
Comment (by robe):
Hopefully I want embarass myself too much by my obvious lack of direction.
---
Now getting to the manual -- observe that in the manual there are 2 cases
where our function is not negatively symmetric
http://www.postgis.org/documentation/manual-
svn/ST_LineCrossingDirection.html
{{{
ELECT ST_LineCrossingDirection(foo.line1, foo.line2) As l1_cross_l2 ,
ST_LineCrossingDirection(foo.line2, foo.line1) As l2_cross_l1
FROM (
SELECT
ST_GeomFromText('LINESTRING(25 169,89 114,40 70,86 43)') As line1,
ST_GeomFromText('LINESTRING (171 154, 20 140, 71 74, 2.99 90.16)') As
line2
) As foo;
l1_cross_l2 | l2_cross_l1
-------------+-------------
2 | -3
}}}
{{{
SELECT ST_LineCrossingDirection(foo.line1, foo.line2) As l1_cross_l2 ,
ST_LineCrossingDirection(foo.line2, foo.line1) As l2_cross_l1
FROM (SELECT
ST_GeomFromText('LINESTRING(25 169,89 114,40 70,86 43)') As line1,
ST_GeomFromText('LINESTRING(2.99 90.16,71 74,20 140,171 154)') As
line2
) As foo;
l1_cross_l2 | l2_cross_l1
-------------+-------------
-2 | 0
}}}
Now if you look at the diagram of these
In case 1 -- the lines cross at 3 points, however from the perspective of
the first line (green) -- the blue line crosses it on the left side first
time, the second time right, and the 3rd time left. (you have to consider
the directionality from the perspective of an observer walking from the
start to end point of the first line -- and which side of him/her is the
second line passing ).
The blue line (line 2) finally ends its journey on the left side relative
to the green line. (2 : LINE MULTICROSS END RIGHT).
Now from the perspective of line 2 (the blue line) -- the green line
crosses it in 3 places - at point one it is crossing to the right of it,
at pt 2 it is crossing to the left of it and the third to the left of it.
But they end up in different directions and their first crosses don't even
seem in the same direction to me. Yet this is (-3) -- I guess I'm not
quite sure what is meant by
END SAME FIRST LEFT (because it would seem if one ends in same first left,
the other should end same first right).
The second example is clearly wrong because -
how can one line cross another and the other doesn't cross it back except
in the Twilight Zone :). This I think is clearly a number counting issue.
Maybe we should just get rid of that 3,-3 option.
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/272#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
PostGIS
More information about the postgis-devel
mailing list