PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_lw_segment_side()

static void test_lw_segment_side ( void  )
static

Definition at line 61 of file cu_algorithm.c.

References lw_segment_side(), POINT2D::x, and POINT2D::y.

Referenced by algorithms_suite_setup().

62 {
63  int rv = 0;
64  POINT2D p1, p2, q;
65 
66  /* Vertical line at x=0 */
67  p1.x = 0.0;
68  p1.y = 0.0;
69  p2.x = 0.0;
70  p2.y = 1.0;
71 
72  /* On the left */
73  q.x = -2.0;
74  q.y = 1.5;
75  rv = lw_segment_side(&p1, &p2, &q);
76  //printf("left %g\n",rv);
77  CU_ASSERT(rv < 0);
78 
79  /* On the right */
80  q.x = 2.0;
81  rv = lw_segment_side(&p1, &p2, &q);
82  //printf("right %g\n",rv);
83  CU_ASSERT(rv > 0);
84 
85  /* On the line */
86  q.x = 0.0;
87  rv = lw_segment_side(&p1, &p2, &q);
88  //printf("on line %g\n",rv);
89  CU_ASSERT_EQUAL(rv, 0);
90 
91 }
double x
Definition: liblwgeom.h:328
double y
Definition: liblwgeom.h:328
int lw_segment_side(const POINT2D *p1, const POINT2D *p2, const POINT2D *q)
lw_segment_side()
Definition: lwalgorithm.c:64
Here is the call graph for this function:
Here is the caller graph for this function: