Projecting a Point onto a Plane

Projecting a Point onto a Plane

This is done in a series of small steps;

  • Defining an Arbitrary point on the plane
  • Creating a Vector from the point to be Projected to the Arbitrary point
  • Define the Dot product of the two vectors
  • Translate the point to be Projected along the Planes Vector

A plane passing through the Point (P) = 1 ; 3 ; 2 and has Normal Vector (N) = 6 ; 7 ; 5, then the equation of the plane is;

Point(P)=1 ; 3 ; 2N=6 ; 7 ; 5Plane Equation=6(x1)+7(y3)+5(z2)=0=6x6+7y21+5z10=0=6x+7y+5z62110=0=6x+7y+5z37=0Point (P) = 1 \space; \space 3 \space ; \space 2 \\ \overrightarrow{N} = 6 \space ; \space 7 \space ; \space 5 \\ Plane \space Equation = 6(x−1 \normalsize)+7(y−3 \normalsize)+5(z−2 \normalsize)=0 \\ = 6x - 6 + 7y-21+5z-10 = 0 \\ = 6x + 7y + 5z -6 -21 -10 = 0 \\ = 6x + 7y + 5z -37 = 0 \\

Defining the Arbitrary Point on the Plane

So now we have the plane equation that we want to work with. Lets start of with an easy one, a Point(B) 12 ; 23 ; 34 projected onto the plane, our first step is to create an arbitrary point on the plane, to do this well use Point(A) 5 ; 5 ; Z

Point(A)=5 ; 5 ; ZPlaneEquation=6x+7y+5z37=0=(65)+(75)+(5Z)37=0=30+35+5Z37=0=5Z=3035+37=5Z=28=Z=28/5=Z=5.6Point (A) = 5 \space; \space 5 \space ; \space Z \\ Plane Equation = 6x + 7y + 5z - 37 = 0 \\ = ( 6 * 5 ) + ( 7 * 5 ) + ( 5 * Z ) - 37 = 0 \\ = 30 + 35 + 5Z - 37 = 0 \\ = 5Z = - 30 - 35 + 37 \\ = 5Z = -28 \\ = Z = -28/5\\ = Z = -5.6

We have now fully resolved Point(A) 5 ; 5 ; -5.6, if we cant resolve for Z, then we should retry resolving for Y or X to define the arbitrary point on the surface.

Defining the Arbitrary Unit Vector

The next step is to create an additional vector from the arbitrary Point(A) 5 ; 5 ; -5.6 to the projection Point(B) 12 ; 23 ; 34

BA=AxBx;AyBy;AzBz=512;523;5.634BA=7;18;39.6I=7;J=18;K=39.6\overrightarrow{BA} \\ = Ax - Bx ; Ay - By ; Az - Bz \\ = 5 - 12 ; 5 - 23 ; -5.6 - 34 \\ \overrightarrow{BA}= -7 ; -18 ; -39.6 \\ I = -7 ; J = -18 ; K = -39.6

Dot Product of the Projection

First Step the magnitude of the planes vector.

N=I2+J2+K2=62+72+52=36+49+25=110=10.488||{N}|| = \sqrt{I^2 + J^2 + K^2} \\ = \sqrt{6^2 + 7^2 + 5^2} \\ = \sqrt{36 + 49 + 25} \\ = \sqrt{110} \\ = 10.488 \\

Next we can convert the planes vector into a unit vector.

N^=N/N=(6/10.488);(7/10.488);(5/10.488)=0.572;0.667;0.476\widehat{N} = \overrightarrow{N} / ||{N}|| \\ = (6/10.488) ; (7/10.488) ; (5/10.488)\\ = 0.572 ; 0.667 ; 0.476 \\

Ok so far so good. Now for the Dot Product of the Projection.

BP=BAN^=(BAXNX)+(BAYNY)+(BAZNZ)=(70.5721)+(180.6674)+(39.60.4767)=4.0047+(12.0132)+(18.5913)=34.897||BP|| = \overrightarrow{BA} \cdotp \widehat{N} \\ = (BA\tiny{X}\cdotp \normalsize N\tiny{X} \normalsize)+(BA\tiny{Y}\cdotp \normalsize N\tiny{Y} \normalsize)+(BA\tiny{Z}\cdotp \normalsize N\tiny{Z} \normalsize)\\ = ( -7 * 0.5721 ) + ( -18 * 0.6674 ) + ( -39.6 * 0.4767 ) \\ = -4.0047 + (-12.0132) + (-18.5913) \\ = -34.897

Translating the vector

Last steps

BP=BP(N^/N)=(34.8970.5721);(34.8970.667);(34.8970.476)=19.964;23.291;16.636\overrightarrow{BP} = ||BP||\cdotp(\widehat{N}/||N||)\\ = (-34.897 * 0.5721) ; (-34.897 * 0.667) ; (-34.897 * 0.476) \\ = -19.964 ; -23.291 ; -16.636

Finally well add the projection point to the vector(BP)

Point(C)=BP+Point(B)=(12+(19.964));(23+(23.291));(34+(16.636))=7.9636;0.2909;17.364Point(C) = \overrightarrow{BP} + Point(B)\\ = (12 + (-19.964)) ; (23 +(-23.291)) ; (34+(-16.636))\\ =-7.9636 ; -0.2909 ; 17.364

C# Code

Using the following C# Code this can be demonstrated.

We can see in the Point Class the Projection Code.

Wireframe Class

C#

Point Class

C#

Line Class

C#

Vector Class

C#

Unit Vector Class

C#

Plane Class

C#