3D投影点,2D平面 [英] Projecting 3D points to 2D plane
问题描述
设A是一个点,我有3D坐标x,y,z和我想将它们转换成二维坐标:X,Y。投影应是正交于由给定的正常限定的平面。在平凡的情况下,如果正常的实际上是其中一个轴,很容易解决,只要消除了协调,但如何对其他案件,这是更可能发生?
Let A be a point for which I have the 3D coordinates x, y, z and I want to transform them into 2D coordinates: x, y. The projection shall be orthogonal on a plane defined by a given normal. The trivial case, where the normal is actually one of the axes, it's easy to solve, simply eliminating a coordinate, but how about the other cases, which are more likely to happen?
推荐答案
如果你有你的目标点的 P 的坐标 R_P =(X,Y,Z)
,并与正常的飞机 N =(NX,NY,NZ)
您需要定义一个原点上了飞机,并为两个正交方向 X
和是
。例如,如果你原点在 r_O =(牛,OY,盎司)
和你的两个坐标轴的平面由 E_1 =定义(ex_1 ,ey_1,ez_1)
, E_2 =(ex_2,ey_2,ez_2)
然后正交有一个点(N,E_1 )= 0
,点(N,E_2)= 0
,点(E_1,E_2)= 0
(向量积)。
If you have your target point P with coordinates r_P = (x,y,z)
and a plane with normal n=(nx,ny,nz)
you need to define an origin on the plane, as well as two orthogonal directions for x
and y
. For example if you origin is at r_O = (ox, oy, oz)
and your two coordinate axis in the plane are defined by e_1 = (ex_1,ey_1,ez_1)
, e_2 = (ex_2,ey_2,ez_2)
then orthogonality has that Dot(n,e_1)=0
, Dot(n,e_2)=0
, Dot(e_1,e_2)=0
(vector dot product).
您目标点的 P 的必须服从方程
Your target point P must obey the equation
r_P = r_O + t_1*e_1 + t_2*e_2 + s*n
其中, T_1
和 T_2
是你的二维坐标沿着 E_1
和 E_2
和取值
的面和点之间的正常间隔(距离)。
where t_1
and t_2
are your 2D coordinates along e_1
and e_2
and s
the normal separation (distance) between the plane and the point.
有标量是通过推算发现
s = Dot(n, r_P-r_O)
t_1 = Dot(e_1, r_P-r_O)
t_2 = Dot(e_2, r_P-r_O)
例有平面原点 r_O =(-1,3,1)
正常
n = r_O/|r_O| = (-1/√11, 3/√11, 1/√11)
您必须选择垂直方向的二维坐标,例如:
You have to pick orthogonal directions for the 2D coordinates, for example
e_1 = (1/√2, 0 ,1/√2)
e_2 = (-3/√22, -2/√22, 3/√22)
,使得点(N,E_1)= 0
和点(N,E_2)= 0
和点(E_1,E_2)= 0
。
二维的点的坐标的 P 的 R_P =(1,7,-3)
是
t_1 = Dot(e_1, r_P-r_O) = ( 1/√2,0,1/√2)·( (1,7,-3)-(-1,3,1) ) = -√2
t_2 = Dot(e_2, r_P-r_O) = (-3/√22, -2/√22, 3/√22)·( (1,7,-3)-(-1,3,1) ) = -26/√22
和出平面分离的
and the out of plane separation
s = Dot(n, r_P-r_O) = 6/√11
这篇关于3D投影点,2D平面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!