PostGIS  2.1.10dev-r@@SVN_REVISION@@
 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 at line 989 of file measures3d.c.

Referenced by lw_dist3d_point_poly(), and lw_dist3d_ptarray_poly().

990 {
991 /*In our plane definition we have a point on the plane and a normal vektor (pl.pv), perpendicular to the plane
992 this vector will be paralell to the line between our inputted point above the plane and the point we are searching for on the plane.
993 So, we already have a direction from p to find p0, but we don't know the distance.
994 */
995
996  VECTOR3D v1;
997  double f;
998
999  if (!get_3dvector_from_points(&(pl->pop), p, &v1))
1000  return LW_FALSE;
1001
1002  f=-(DOT(pl->pv,v1)/DOT(pl->pv,pl->pv));
1003
1004  p0->x=p->x+pl->pv.x*f;
1005  p0->y=p->y+pl->pv.y*f;
1006  p0->z=p->z+pl->pv.z*f;
1007
1008  return f;
1009 }
double z
Definition: liblwgeom.h:290
double y
Definition: liblwgeom.h:290
double x
Definition: liblwgeom.h:290
double z
Definition: measures3d.h:36
VECTOR3D pv
Definition: measures3d.h:43
double y
Definition: measures3d.h:36
#define DOT(u, v)
Definition: measures3d.h:16
#define LW_FALSE
Definition: liblwgeom.h:52
POINT3DZ pop
Definition: measures3d.h:42
int get_3dvector_from_points(POINT3DZ *p1, POINT3DZ *p2, VECTOR3D *v)
Definition: measures3d.h:85
double x
Definition: measures3d.h:36

Here is the call graph for this function:

Here is the caller graph for this function: