将3d平面上的点转换为2d坐标 [英] Convert points on a 3d Plane to 2d Coordinates
问题描述
我有一个点云,所有点都位于3D空间中的平面上.我需要将每个点转换为2D坐标,反之亦然.
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)=>坐标系 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.
槭树,其点为A=1,1,1 B=2,1,1 C=1,1,2 (in plane 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屋!