PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lw_segment_side()

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 65 of file lwalgorithm.c.

66 {
67  double side = ( (q->x - p1->x) * (p2->y - p1->y) - (p2->x - p1->x) * (q->y - p1->y) );
68  return SIGNUM(side);
69 }
#define SIGNUM(n)
Macro that returns: -1 if n < 0, 1 if n > 0, 0 if n == 0.
double y
Definition: liblwgeom.h:376
double x
Definition: liblwgeom.h:376

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_dist2d_arc_arc_concentric(), lw_pt_in_arc(), lw_segment_intersects(), lwarc_linearize(), pt_continues_arc(), pta_unstroke(), ptarray_contains_point_partial(), rect_leaf_node_segment_side(), and test_lw_segment_side().

Here is the caller graph for this function: