如何将点投影到3D平面上? [英] How to project a point onto a plane in 3D?
问题描述
我有一个3D点(point_x,point_y,point_z),我想将其投影到3D空间中的2D平面上,该平面由点坐标(orig_x,orig_y,orig_z)和一元垂直线定义向量(normal_dx,normal_dy,normal_dz)。
我应该如何处理?
1)从您的 orig
指向兴趣点:
v =点源(在每个维度中);
2)取该向量与单位法向向量 n
的点积:
dist = vx * nx + vy * ny + vz * nz;
dist =沿法线从点到平面的标量距离/ p>
3)将单位法向向量乘以距离,然后从您的点减去该向量。
projected_point = point-dist * normal;
编辑图片:
我对您的照片做了一些修改。红色为 v
; v
点 normal
=蓝色和绿色的长度( dist
以上)。蓝色是 normal * dist
。 Green = blue * -1
:要找到plane_xyz,从点
开始并添加绿色矢量。
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?
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.
这篇关于如何将点投影到3D平面上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!