Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find the orthogonal projection of a point onto a plane

Tags:

math

3d

Lets say I have point (x,y,z) and plane with point (a,b,c) and normal (d,e,f). I want to find the point that is the result of the orthogonal projection of the first point onto the plane. I am using this in 3d graphics programming. I want to achieve some sort of clipping onto the plane.

like image 300
DogDog Avatar asked Jan 20 '12 14:01

DogDog


People also ask

What is an orthogonal projection onto a plane?

The projection of a vector on a plane is its orthogonal projection on that plane. The rejection of a vector from a plane is its orthogonal projection on a straight line which is orthogonal to that plane. Both are vectors. The first is parallel to the plane, the second is orthogonal.

What is the orthogonal projection of point?

Orthogonal projection of a point is the process of finding a point on a curve or a surface such that the vector connecting the point in space and the point on the curve or the surface becomes perpendicular to the curve or the surface.

How do you find the projection of a point?

x = x0 + a · t, y = y0 + b · t and z = z0 + c · t, These variable coordinates of a point of the line plugged into the equation of the plane will determine the value of the parameter t such that this point will be, at the same time, on the line and the plane.


2 Answers

The projection of a point q = (x, y, z) onto a plane given by a point p = (a, b, c) and a normal n = (d, e, f) is

q_proj = q - dot(q - p, n) * n 

This calculation assumes that n is a unit vector.

like image 182
antonakos Avatar answered Oct 06 '22 23:10

antonakos


I've implemented this function in Qt using QVector3D:

QVector3D getPointProjectionInPlane(QVector3D point, QVector3D planePoint, QVector3D planeNormal) {     //q_proj = q - dot(q - p, n) * n     QVector3D normalizedPlaneNormal = planeNormal.normalized();     QVector3D pointProjection = point - QVector3D::dotProduct(point - planePoint, normalizedPlaneNormal) * normalizedPlaneNormal;     return pointProjection; } 
like image 35
Fernando Avatar answered Oct 07 '22 00:10

Fernando