如何创建任意共面 3d 曲线的 2d 图 [英] How to create 2d plot of arbitrary, coplanar 3d curve
问题描述
我有一组包含(理论上)共面曲线的点.我的问题是平面是任意的,每次我收集数据时都可以在它们之间移动(这些点是从相机收集的).我想知道你们是否可以帮我弄清楚如何:
I have a set of points which comprise a (in theory) co-planar curve. My problem is that the plane is arbitrary and can move between each time I collect the data (these points are being collected from a camera). I was wondering if you guys could help me figure out how to:
- 找到离这些点共面的平面最近的平面
- 以这样的方式投影该平面上的点,从而为我提供二维曲线
我相信我知道如何做第 2 点,我真正在努力解决的主要是第 1 点,但我也不介意在第二点上提供帮助.
I believe that I know how to do point 2, it is really mainly point 1 that i'm struggling with, but I wouldn't mind help on the second point as well.
非常感谢!
推荐答案
在您的数据中找出 3 个点
A,B,C
它们不能在一条线上,并且应该尽可能远离以提高准确性.
They must not be on single line and should be as far from each other as possible to improve accuracy.
构造U,V
基向量
Construct U,V
basis vectors
U = B-A
V = C-A
标准化
U /= |U|
V /= |V|
使U,V
垂直
W = cross(U,V) // this will be near zero if A,B,C are on single line
U = cross(V,W)
将您的数据转换为U,V
平面
Convert your data to U,V
plane
简单地用于数据计算中的任何点 P=(x,y,z)
:
simply for any point P=(x,y,z)
in your data compute:
x' = dot(U,P)
y' = dot(V,P)
如果您还需要反向转换:
in case you need also the reverse conversion:
P = x'*U + y'*V
如果你想要/有一个原点A
,转换将是:
In case you want/have an origin point A
the conversions would be:
x' = dot(U,P-A)
y' = dot(V,P-A)
P = A + x'*U + y'*V
这会将 A
映射到您的 2D 坐标中的 (0,0)
.
That will map A
to (0,0)
in your 2D coordinates.
如果您不知道矢量数学,请看这里:
In case you do not know your vector math look here:
在底部您会找到向量运算的方程式.希望有帮助...
at the bottom you will find the equation for vector operations. Hope that helps ...
这篇关于如何创建任意共面 3d 曲线的 2d 图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!