将 3D 点转换为 2D
我有一组点 (x1, x2,..xn) 位于由 Ax+ By+Cz+d=0 定义的平面上。 我想找到转换矩阵来平移和旋转到 XY 平面。因此,新的点坐标将为 x1'=(xnew, ynew,0)。
很多答案给出四元数、点或叉积矩阵。我不确定哪一种是正确的方法。
谢谢
I have a set of points (x1, x2,..xn) that lie on the plane define by Ax+ By+Cz+d=0.
I would like to find the transformation matrix to translate and rotate to XY plane. So, the new point coordinate will be x1'=(xnew, ynew,0).
A lot of answer give quaternion, dot or cross product matrix. I am not sure which one is the correct way.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,除非在你的平面方程中,d=0,否则没有线性变换你可以申请。您需要执行仿射变换。
实现此目的的一种方法是确定要旋转的角度和矢量,以使点集位于与 XY 平面平行的平面中(即,变换后的点集的 Z 分量都具有相同的值)。然后您只需删除 Z 分量即可。
为此,让 V 为包含点的平面的标准化平面法线。为了方便起见,从上面的平面方程定义 Ax+By+Cz+d=0:
其中
角度将简单地为:
围绕其旋转的轴 R 只是标准化平面法线的叉积 < b>V' 和 Z。也就是说,
您现在可以使用此角度/轴对来构建旋转所有所需的四元数旋转将数据集中的点映射到与 XY 平面平行的平面。然后,正如我之前所说,只需放下 Z 分量即可在 XY 平面上执行正交投影。
更新: antonakos 在使用 API 获取轴/角度对之前对 R 进行归一化提出了很好的观点。
First of all, unless in your plane equation, d=0, there is no linear transformation you can apply. You need to instead perform an affine transformation.
One way to do this is to determine an angle and vector about which to rotate to make your pointset lie in a plane parallel to the XY plane (ie. the Z component of your transformed pointset to all have the same values). Then you simply drop the Z component.
For this, let V be the normalized plane normal for the plane containing your points. For convenience define from your plane equation above Ax+By+Cz+d=0:
where
The angle will simply be:
The axis R about which to rotate is just the cross product of the normalized plane normal V' and Z. That is
You can now use this angle / axis pair to build the quaternion rotation needed to rotate all of the points in your dataset to a plane parallel to the XY plane. Then, a I said earlier, just drop the Z component to perform an orthogonal projection onto the XY plane.
Update: antonakos makes a good point about normalizing the R before using an API taking axis / angle pairs.