PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ isOnSegment()

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

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

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