lwline_crossing_direction: returns the kind of CG_LINE_CROSS_TYPE behavior of 2 linestrings
Given two lines, characterize how (and if) they cross each other.
- Parameters
-
l1 | first line string |
l2 | second line string |
- Returns
- a CG_LINE_CROSS_TYPE LINE_NO_CROSS = 0 LINE_CROSS_LEFT = -1 LINE_CROSS_RIGHT = 1 LINE_MULTICROSS_END_LEFT = -2 LINE_MULTICROSS_END_RIGHT = 2 LINE_MULTICROSS_END_SAME_FIRST_LEFT = -3 LINE_MULTICROSS_END_SAME_FIRST_RIGHT = 3
Definition at line 461 of file lwalgorithm.c.
464 const POINT2D *p1, *p2, *q1, *q2;
470 #if POSTGIS_DEBUG_LEVEL >= 4
478 if ( pa1->
npoints < 2 || pa2->npoints < 2 )
481 #if POSTGIS_DEBUG_LEVEL >= 4
493 for ( i = 1; i < pa2->npoints; i++ )
502 for ( j = 1; j < pa1->
npoints; j++ )
510 LWDEBUGF(4,
"i=%d, j=%d (%.8g %.8g, %.8g %.8g)", this_cross, i, j, p1->
x, p1->
y, p2->
x, p2->
y);
514 LWDEBUG(4,
"this_cross == SEG_CROSS_LEFT");
522 LWDEBUG(4,
"this_cross == SEG_CROSS_RIGHT");
535 LWDEBUG(4,
"this_cross == SEG_COLINEAR");
541 LWDEBUG(4,
"this_cross == SEG_NO_INTERSECTION");
553 LWDEBUGF(4,
"first_cross=%d, cross_left=%d, cross_right=%d", first_cross, cross_left, cross_right);
555 if ( !cross_left && !cross_right )
558 if ( !cross_left && cross_right == 1 )
561 if ( !cross_right && cross_left == 1 )
564 if ( cross_left - cross_right == 1 )
567 if ( cross_left - cross_right == -1 )
570 if ( cross_left - cross_right == 0 && first_cross ==
SEG_CROSS_LEFT )
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
@ LINE_MULTICROSS_END_RIGHT
@ LINE_MULTICROSS_END_SAME_FIRST_LEFT
@ LINE_MULTICROSS_END_LEFT
@ LINE_MULTICROSS_END_SAME_FIRST_RIGHT
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
int lw_segment_intersects(const POINT2D *p1, const POINT2D *p2, const POINT2D *q1, const POINT2D *q2)
returns the kind of CG_SEGMENT_INTERSECTION_TYPE behavior of lineseg 1 (constructed from p1 and p2) a...
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
References getPoint2d_cp(), LINE_CROSS_LEFT, LINE_CROSS_RIGHT, LINE_MULTICROSS_END_LEFT, LINE_MULTICROSS_END_RIGHT, LINE_MULTICROSS_END_SAME_FIRST_LEFT, LINE_MULTICROSS_END_SAME_FIRST_RIGHT, LINE_NO_CROSS, lw_segment_intersects(), LWDEBUG, LWDEBUGF, lwfree(), lwgeom_to_ewkt(), POINTARRAY::npoints, LWLINE::points, SEG_COLINEAR, SEG_CROSS_LEFT, SEG_CROSS_RIGHT, POINT2D::x, and POINT2D::y.
Referenced by ST_LineCrossingDirection(), test_lwline_crossing_bugs(), test_lwline_crossing_long_lines(), and test_lwline_crossing_short_lines().