PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lw_dist3d_pt_ptarray()

int lw_dist3d_pt_ptarray ( POINT3DZ p,

search all the segments of pointarray to see which one is closest to p Returns distance between point and pointarray

Definition at line 693 of file measures3d.c.

References DIST_MIN, DISTPTS3D::distance, getPoint3dz_p(), lw_dist3d_pt_seg(), LW_FALSE, LW_TRUE, LWDEBUG, DISTPTS3D::mode, POINTARRAY::npoints, DISTPTS3D::tolerance, and DISTPTS3D::twisted.

Referenced by lw_dist3d_point_line(), lw_dist3d_point_poly(), and lw_dist3d_pt_poly().

694 {
695  int t;
696  POINT3DZ start, end;
697  int twist = dl->twisted;
699  LWDEBUG(2, "lw_dist3d_pt_ptarray is called");
701  getPoint3dz_p(pa, 0, &start);
703  for (t=1; t<pa->npoints; t++)
704  {
705  dl->twisted=twist;
706  getPoint3dz_p(pa, t, &end);
707  if (!lw_dist3d_pt_seg(p, &start, &end,dl)) return LW_FALSE;
709  if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return LW_TRUE; /*just a check if the answer is already given*/
710  start = end;
711  }
713  return LW_TRUE;
714 }
double distance
Definition: measures3d.h:27
int npoints
Definition: liblwgeom.h:355
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
#define DIST_MIN
Definition: measures.h:17
int getPoint3dz_p(const POINTARRAY *pa, int n, POINT3DZ *point)
Definition: lwgeom_api.c:319
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
int twisted
Definition: measures3d.h:31
int mode
Definition: measures3d.h:30
double tolerance
Definition: measures3d.h:32
int lw_dist3d_pt_seg(POINT3DZ *p, POINT3DZ *A, POINT3DZ *B, DISTPTS3D *dl)
If searching for min distance, this one finds the closest point on segment A-B from p...
Definition: measures3d.c:723
Here is the call graph for this function:
Here is the caller graph for this function: