PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ isOnSegment()

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

Definition at line 672 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().

673 {
674  double maxX;
675  double maxY;
676  double minX;
677  double minY;
678 
679  if (seg1->x > seg2->x)
680  {
681  maxX = seg1->x;
682  minX = seg2->x;
683  }
684  else
685  {
686  maxX = seg2->x;
687  minX = seg1->x;
688  }
689  if (seg1->y > seg2->y)
690  {
691  maxY = seg1->y;
692  minY = seg2->y;
693  }
694  else
695  {
696  maxY = seg2->y;
697  minY = seg1->y;
698  }
699 
700  POSTGIS_DEBUGF(3, "maxX minX/maxY minY: %.8f %.8f/%.8f %.8f", maxX, minX, maxY, minY);
701 
702  if (maxX < point->x || minX > point->x)
703  {
704  POSTGIS_DEBUGF(3, "X value %.8f falls outside the range %.8f-%.8f", point->x, minX, maxX);
705 
706  return 0;
707  }
708  else if (maxY < point->y || minY > point->y)
709  {
710  POSTGIS_DEBUGF(3, "Y value %.8f falls outside the range %.8f-%.8f", point->y, minY, maxY);
711 
712  return 0;
713  }
714  return 1;
715 }
double x
Definition: liblwgeom.h:328
double y
Definition: liblwgeom.h:328
Here is the caller graph for this function: