PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_lwline_crossing_short_lines()

static void test_lwline_crossing_short_lines ( void  )
static

Definition at line 261 of file cu_algorithm.c.

References LINE_CROSS_RIGHT, LINE_NO_CROSS, lwline_crossing_direction(), ptarray_set_point4d(), POINT4D::x, and POINT4D::y.

Referenced by algorithms_suite_setup().

262 {
263 
264  POINT4D p;
265 
266  /*
267  ** Simple test, two two-point lines
268  */
269 
270  /* Vertical line from 0,0 to 1,1 */
271  p.x = 0.0;
272  p.y = 0.0;
273  ptarray_set_point4d(pa21, 0, &p);
274  p.y = 1.0;
275  ptarray_set_point4d(pa21, 1, &p);
276 
277  /* Horizontal, crossing mid-segment */
278  p.x = -0.5;
279  p.y = 0.5;
280  ptarray_set_point4d(pa22, 0, &p);
281  p.x = 0.5;
282  ptarray_set_point4d(pa22, 1, &p);
283 
285 
286  /* Horizontal, crossing at top end vertex (end crossings don't count) */
287  p.x = -0.5;
288  p.y = 1.0;
289  ptarray_set_point4d(pa22, 0, &p);
290  p.x = 0.5;
291  ptarray_set_point4d(pa22, 1, &p);
292 
294 
295  /* Horizontal, crossing at bottom end vertex */
296  p.x = -0.5;
297  p.y = 0.0;
298  ptarray_set_point4d(pa22, 0, &p);
299  p.x = 0.5;
300  ptarray_set_point4d(pa22, 1, &p);
301 
303 
304  /* Horizontal, no crossing */
305  p.x = -0.5;
306  p.y = 2.0;
307  ptarray_set_point4d(pa22, 0, &p);
308  p.x = 0.5;
309  ptarray_set_point4d(pa22, 1, &p);
310 
312 
313  /* Vertical, no crossing */
314  p.x = -0.5;
315  p.y = 0.0;
316  ptarray_set_point4d(pa22, 0, &p);
317  p.y = 1.0;
318  ptarray_set_point4d(pa22, 1, &p);
319 
321 
322 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:437
double x
Definition: liblwgeom.h:352
int lwline_crossing_direction(const LWLINE *l1, const LWLINE *l2)
Given two lines, characterize how (and if) they cross each other.
Definition: lwalgorithm.c:460
POINTARRAY * pa21
Definition: cu_algorithm.c:25
LWLINE * l22
Definition: cu_algorithm.c:28
LWLINE * l21
Definition: cu_algorithm.c:27
double y
Definition: liblwgeom.h:352
POINTARRAY * pa22
Definition: cu_algorithm.c:26
Here is the call graph for this function:
Here is the caller graph for this function: