PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lw_dist3d_point_tri()

int lw_dist3d_point_tri ( LWPOINT point,
LWTRIANGLE tri,
DISTPTS3D dl 
)

Definition at line 770 of file measures3d.c.

771 {
772  POINT3DZ p, projp; /*projp is "point projected on plane"*/
773  PLANE3D plane;
774  getPoint3dz_p(point->point, 0, &p);
775 
776  /* If we are looking for max distance, longestline or dfullywithin */
777  if (dl->mode == DIST_MAX)
778  return lw_dist3d_pt_ptarray(&p, tri->points, dl);
779 
780  /* If triangle does not define a plane, treat it as a line */
781  if (!define_plane(tri->points, &plane))
782  return lw_dist3d_pt_ptarray(&p, tri->points, dl);
783 
784  /* Get our point projected on the plane of triangle */
785  project_point_on_plane(&p, &plane, &projp);
786 
787  return lw_dist3d_pt_tri(&p, tri, &plane, &projp, dl);
788 }
int getPoint3dz_p(const POINTARRAY *pa, uint32_t n, POINT3DZ *point)
Definition: lwgeom_api.c:215
int lw_dist3d_pt_tri(POINT3DZ *p, LWTRIANGLE *tri, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl)
Definition: measures3d.c:1277
int lw_dist3d_pt_ptarray(POINT3DZ *p, POINTARRAY *pa, DISTPTS3D *dl)
search all the segments of pointarray to see which one is closest to p Returns distance between point...
Definition: measures3d.c:962
int define_plane(POINTARRAY *pa, PLANE3D *pl)
Definition: measures3d.c:1451
double project_point_on_plane(POINT3DZ *p, PLANE3D *pl, POINT3DZ *p0)
Finds a point on a plane from where the original point is perpendicular to the plane.
Definition: measures3d.c:1524
#define DIST_MAX
Definition: measures.h:43
int mode
Definition: measures3d.h:43
POINTARRAY * point
Definition: liblwgeom.h:457
POINTARRAY * points
Definition: liblwgeom.h:481

References define_plane(), DIST_MAX, getPoint3dz_p(), lw_dist3d_pt_ptarray(), lw_dist3d_pt_tri(), DISTPTS3D::mode, LWPOINT::point, LWTRIANGLE::points, and project_point_on_plane().

Referenced by lw_dist3d_distribute_bruteforce().

Here is the call graph for this function:
Here is the caller graph for this function: