PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lw_dist3d_point_tri()

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

Definition at line 767 of file measures3d.c.

768 {
769  POINT3DZ p, projp; /*projp is "point projected on plane"*/
770  PLANE3D plane;
771  getPoint3dz_p(point->point, 0, &p);
772 
773  /* If we are looking for max distance, longestline or dfullywithin */
774  if (dl->mode == DIST_MAX)
775  return lw_dist3d_pt_ptarray(&p, tri->points, dl);
776 
777  /* If triangle does not define a plane, treat it as a line */
778  if (!define_plane(tri->points, &plane))
779  return lw_dist3d_pt_ptarray(&p, tri->points, dl);
780 
781  /* Get our point projected on the plane of triangle */
782  project_point_on_plane(&p, &plane, &projp);
783 
784  return lw_dist3d_pt_tri(&p, tri, &plane, &projp, dl);
785 }
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:1274
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:959
int define_plane(POINTARRAY *pa, PLANE3D *pl)
Definition: measures3d.c:1448
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:1521
#define DIST_MAX
Definition: measures.h:43
int mode
Definition: measures3d.h:43
POINTARRAY * point
Definition: liblwgeom.h:471
POINTARRAY * points
Definition: liblwgeom.h:495

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: