PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ project_point_on_plane()

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 1179 of file measures3d.c.

References DOT, get_3dvector_from_points(), LW_FALSE, PLANE3D::pop, PLANE3D::pv, VECTOR3D::x, POINT3DZ::x, VECTOR3D::y, POINT3DZ::y, VECTOR3D::z, and POINT3DZ::z.

Referenced by lw_dist3d_point_poly(), and lw_dist3d_ptarray_poly().

1180 {
1181 /*In our plane definition we have a point on the plane and a normal vektor (pl.pv), perpendicular to the plane
1182 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.
1183 So, we already have a direction from p to find p0, but we don't know the distance.
1184 */
1185 
1186  VECTOR3D v1;
1187  double f;
1188 
1189  if (!get_3dvector_from_points(&(pl->pop), p, &v1))
1190  return LW_FALSE;
1191 
1192  f=-(DOT(pl->pv,v1)/DOT(pl->pv,pl->pv));
1193 
1194  p0->x=p->x+pl->pv.x*f;
1195  p0->y=p->y+pl->pv.y*f;
1196  p0->z=p->z+pl->pv.z*f;
1197 
1198  return f;
1199 }
double z
Definition: liblwgeom.h:318
double y
Definition: liblwgeom.h:318
double x
Definition: liblwgeom.h:318
double z
Definition: measures3d.h:37
VECTOR3D pv
Definition: measures3d.h:44
double y
Definition: measures3d.h:37
#define DOT(u, v)
Definition: measures3d.h:17
#define LW_FALSE
Definition: liblwgeom.h:62
static int get_3dvector_from_points(POINT3DZ *p1, POINT3DZ *p2, VECTOR3D *v)
Definition: measures3d.c:21
POINT3DZ pop
Definition: measures3d.h:43
double x
Definition: measures3d.h:37
Here is the call graph for this function:
Here is the caller graph for this function: