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?
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.
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) 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With