PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ isOnSegment()

int isOnSegment ( POINT2D seg1,
POINT2D seg2,
POINT2D point 
)

Definition at line 641 of file lwgeom_functions_analytic.c.

References pixval::x, POINT2D::x, pixval::y, and POINT2D::y.

Referenced by point_in_ring(), and point_in_ring_rtree().

642 {
643  double maxX;
644  double maxY;
645  double minX;
646  double minY;
647 
648  if (seg1->x > seg2->x)
649  {
650  maxX = seg1->x;
651  minX = seg2->x;
652  }
653  else
654  {
655  maxX = seg2->x;
656  minX = seg1->x;
657  }
658  if (seg1->y > seg2->y)
659  {
660  maxY = seg1->y;
661  minY = seg2->y;
662  }
663  else
664  {
665  maxY = seg2->y;
666  minY = seg1->y;
667  }
668 
669  POSTGIS_DEBUGF(3, "maxX minX/maxY minY: %.8f %.8f/%.8f %.8f", maxX, minX, maxY, minY);
670 
671  if (maxX < point->x || minX > point->x)
672  {
673  POSTGIS_DEBUGF(3, "X value %.8f falls outside the range %.8f-%.8f", point->x, minX, maxX);
674 
675  return 0;
676  }
677  else if (maxY < point->y || minY > point->y)
678  {
679  POSTGIS_DEBUGF(3, "Y value %.8f falls outside the range %.8f-%.8f", point->y, minY, maxY);
680 
681  return 0;
682  }
683  return 1;
684 }
double x
Definition: liblwgeom.h:312
double y
Definition: liblwgeom.h:312
Here is the caller graph for this function: