将 3d 平面上的点转换为 2d 坐标 [英] Convert points on a 3d Plane to 2d Coordinates
问题描述
我有一个点云,所有点都位于 3D 空间中的一个平面上.我需要将每个点转换为二维坐标,反之亦然.
I have a point cloud, all the points lie on a plane in 3D Space. I need to convert each point to 2D Coordinates and vice versa.
(x,y,z) 在坐标系 A => 变换矩阵 (T1) => (x,y) 在坐标系 B
(x,y,z) in Coordinate System A => Transformation Matrix (T1) => (x,y) in Coordinate System B
(x,y) 在坐标系 B => 变换矩阵 (T2) => (x,y,z) 在坐标系 A
(x,y) in Coordinate System B => Transformation Matrix (T2) => (x,y,z) in Coordinate System A
我需要T1和T2.坐标系B可以是任意参考系.
I need T1 and T2. The coordinate system B can be any arbitrary reference frame.
推荐答案
据我所知,所有的点都在同一个平面上,你想降维后恢复坐标.
As far as I understand, all points lie in the same plane, and you want to reduce dimension and later restore coordinates.
得到三个不共线的点 A、B、C.制作向量 AB 和 AC.
该平面的法线是
Get three non-collinear points A, B, C. Make vectors AB and AC.
Normal to that plane is
N = AB x AC //cross product
现在标准化向量AB和N得到单位U = uAB
和uN
.构建第二个基向量(它是单位并且位于平面内)
Now normalize vectors AB and N getting unit U = uAB
and uN
. Build the second base vector (it is unit and lies in the plane)
V = U x uN
现在你有四个基点A, u=A+U, v=A+V, n=A+uN
转换应该将这些点映射成四元组(0,0,0), (1,0,0), (0,1,0), (0,0,1)
.
Tranformation should map these points into quadruplet (0,0,0), (1,0,0), (0,1,0), (0,0,1)
correspondingly.
现在关于进行此映射的仿射变换矩阵:
Now about affine transformation matrix to make this mapping:
[Ax ux vx nx] [0 1 0 0]
M * [Ay uy vy ny] = [0 0 1 0]
[Az uz vz nz] [0 0 0 1]
[1 1 1 1 ] [1 1 1 1]
或
M * S = D
M * S * Sinv = D * Sinv
M = D * Sinv
因此计算S=[Ax ux...]
的逆矩阵并得到所需的矩阵M.
So calculate inverse matrix for S=[Ax ux...]
and get needed matrix M.
将 M 应用到平面中的任何点都会给出具有零 z 分量的新坐标.
Application of M to any point in the plane gives new coordinates with zero z-component.
将 M 的倒数应用到 (x,y,0) 导致给定平面中的 3D 坐标.
Application of inverse of M to (x,y,0) results 3D coordinates in given plane.
Maple sheet 带点 A=1,1,1 B=2,1,1 C=1,1,2(在平面 Y=1)
新坐标 AA、BB、CC 的 z 分量为零.
new coordinates AA, BB, CC have zero z-component.
对于同一平面内任意点,映射后z分量也为零.
For arbitrary point in the same plane z-component after mapping is zero too.
P:=vector([-2,1,7,1]);
> PP := multiply(M, P);
PP := [-3, 6, 0, 1]
这篇关于将 3d 平面上的点转换为 2d 坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!