Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to project a point onto a plane in 3D?

Tags:

c++

c

I have a 3D point (point_x,point_y,point_z) and I want to project it onto a 2D plane in 3D space which (the plane) is defined by a point coordinates (orig_x,orig_y,orig_z) and a unary perpendicular vector (normal_dx,normal_dy,normal_dz).

How should I handle this?enter image description here

like image 900
George Avatar asked Mar 07 '12 16:03

George


People also ask

How do you calculate point projection?

If you want to calculate the projection by hand, use the vector projection formula p = (a·b / b·b) * b and follow this step by step procedure: Calculate the dot product of vectors a and b: a·b = 2*3 + (-3)*6 + 5*(-4) = -32. Calculate the dot product of vector b with itself: b·b = 3*3 + 6*6 + (-4)*(-4) = 61.

How do you project a point onto the xy plane?

The projection of a point (x, y, z) onto the xy-plane is obtained by connecting the point to the xy-plane by a line segment that is perpendicular to the plane, and computing the intersection of the line segment with the plane.


1 Answers

1) Make a vector from your orig point to the point of interest:

v = point-orig (in each dimension);

2) Take the dot product of that vector with the unit normal vector n:

dist = vx*nx + vy*ny + vz*nz; dist = scalar distance from point to plane along the normal

3) Multiply the unit normal vector by the distance, and subtract that vector from your point.

projected_point = point - dist*normal;

Edit with picture: I've modified your picture a bit. Red is v; v dot normal = length of blue and green (dist above). Blue is normal*dist. Green = blue * -1 : to find planar_xyz, start from point and add the green vector.

enter image description here

like image 85
tmpearce Avatar answered Sep 22 '22 01:09

tmpearce