PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lw_dist3d_point_tri()

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

Definition at line 804 of file measures3d.c.

805 {
806  POINT3DZ p, projp; /*projp is "point projected on plane"*/
807  PLANE3D plane;
808  getPoint3dz_p(point->point, 0, &p);
809 
810  /* If we are looking for max distance, longestline or dfullywithin */
811  if (dl->mode == DIST_MAX)
812  return lw_dist3d_pt_ptarray(&p, tri->points, dl);
813 
814  /* If triangle does not define a plane, treat it as a line */
815  if (!define_plane(tri->points, &plane))
816  return lw_dist3d_pt_ptarray(&p, tri->points, dl);
817 
818  /* Get our point projected on the plane of triangle */
819  project_point_on_plane(&p, &plane, &projp);
820 
821  return lw_dist3d_pt_tri(&p, tri, &plane, &projp, dl);
822 }
int getPoint3dz_p(const POINTARRAY *pa, uint32_t n, POINT3DZ *point)
Definition: lwgeom_api.c:215
static double project_point_on_plane(const 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:57
int lw_dist3d_pt_ptarray(const POINT3DZ *p, const 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:996
int define_plane(const POINTARRAY *pa, PLANE3D *pl)
Definition: measures3d.c:1491
int lw_dist3d_pt_tri(const POINT3DZ *p, const LWTRIANGLE *tri, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl)
Definition: measures3d.c:1317
#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: