PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 512 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().

513 {
514  int t;
515  POINT3DZ start, end;
516  int twist = dl->twisted;
518  LWDEBUG(2, "lw_dist3d_pt_ptarray is called");
520  getPoint3dz_p(pa, 0, &start);
522  for (t=1; t<pa->npoints; t++)
523  {
524  dl->twisted=twist;
525  getPoint3dz_p(pa, t, &end);
526  if (!lw_dist3d_pt_seg(p, &start, &end,dl)) return LW_FALSE;
528  if (dl->distance<=dl->tolerance && dl->mode == DIST_MIN) return LW_TRUE; /*just a check if the answer is already given*/
529  start = end;
530  }
532  return LW_TRUE;
533 }
double distance
Definition: measures3d.h:26
int npoints
Definition: liblwgeom.h:327
#define DIST_MIN
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
int getPoint3dz_p(const POINTARRAY *pa, int n, POINT3DZ *point)
Definition: lwgeom_api.c:305
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
int twisted
Definition: measures3d.h:30
int mode
Definition: measures3d.h:29
double tolerance
Definition: measures3d.h:31
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:542

Here is the call graph for this function:

Here is the caller graph for this function: