PostGIS  2.1.10dev-r@@SVN_REVISION@@
int lw_segment_side ( const POINT2D p1,
const POINT2D p2,
const POINT2D q 
)

lw_segment_side()

Return -1 if point Q is left of segment P Return 1 if point Q is right of segment P Return 0 if point Q in on segment P

Definition at line 62 of file lwalgorithm.c.

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

Referenced by edge_calculate_gbox(), lw_arc_calculate_gbox_cartesian_2d(), lw_arc_length(), lw_arc_side(), lw_pt_in_arc(), lw_segment_intersects(), lwcircle_segmentize(), pt_continues_arc(), pta_desegmentize(), ptarray_contains_point_partial(), rect_tree_contains_point(), and test_lw_segment_side().

63 {
64  double side = ( (q->x - p1->x) * (p2->y - p1->y) - (p2->x - p1->x) * (q->y - p1->y) );
65  if ( side == 0.0 )
66  return 0;
67  else
68  return signum(side);
69 }
double x
Definition: liblwgeom.h:284
int signum(double n)
Returns -1 if n < 0.0 and 1 if n > 0.0.
Definition: lwalgorithm.c:21
double y
Definition: liblwgeom.h:284

Here is the call graph for this function:

Here is the caller graph for this function: