来自最小二乘法导出平面的法向向量
我有一组点,我可以导出以下形式的最小二乘解:
z = Ax + By + C
我计算的系数是正确的,但是如何在这种形式的方程中获得垂直于平面的向量?使用我的测试数据集,简单地使用该方程中的 A、B 和 C 系数作为法线向量似乎并不正确。
I have a set of points and I can derive a least squares solution in the form:
z = Ax + By + C
The coefficients I compute are correct, but how would I get the vector normal to the plane in an equation of this form? Simply using A, B and C coefficients from this equation don't seem correct as a normal vector using my test dataset.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据 dmckee 的回答:
axb = (a2b3 − a3b2), (a3b1 − a1b3), (a1b2 − a2b1)
在你的情况下 a1=1, a2=0 a3=A b1=0 b2=1 b3=B
所以 = ( -A), (-B), (1)
Following on from dmckee's answer:
a x b = (a2b3 − a3b2), (a3b1 − a1b3), (a1b2 − a2b1)
In your case a1=1, a2=0 a3=A b1=0 b2=1 b3=B
so = (-A), (-B), (1)
形成两个
都位于平面上的向量并取叉积:
它之所以有效,是因为两个向量的叉积始终垂直于两个输入。因此,在平面上使用两个(非共线)向量可以得到法线。
注意:当然,您可能想要一个归一化正态,但我将把它留作练习。
Form the two vectors
both of which lie in the plane and take the cross-product:
It works because the cross-product of two vectors is always perpendicular to both of the inputs. So using two (non-colinear) vectors in the plane gives you a normal.
NB: You probably want a normalized normal, of course, but I'll leave that as an exercise.
dmckee 的答案有一点额外的色彩。我会直接发表评论,但我还没有足够的 SO 代表。 ;-(
当 C=0 时,平面 z = Ax + By + C 仅包含点 (1, 0, A) 和 (0, 1, B)。因此,我们将讨论平面 z = Ax + By当然,这很好,因为第二个平面与原始平面平行,因此我们希望计算的正交向量在这样的平移下是不变的,所以不会造成任何损害
。措辞是他指定的“向量”位于平面上,而不是点上,所以他可以说被覆盖了,但我觉得明确承认隐含的翻译是有帮助的,
我也花了一段时间在这件事上
。你的...;-)
A little extra color on the dmckee answer. I'd comment directly, but I do not have enough SO rep yet. ;-(
The plane z = Ax + By + C only contains the points (1, 0, A) and (0, 1, B) when C=0. So, we would be talking about the plane z = Ax + By. Which is fine, of course, since this second plane is parallel to the original one, the unique vertical translation that contains the origin. The orthogonal vector we wish to compute is invariant under translations like this, so no harm done.
Granted, dmckee's phrasing is that his specified "vectors" lie in the plane, not the points, so he's arguably covered. But it strikes me as helpful to explicitly acknowledge the implied translations.
Boy, it's been a while for me on this stuff, too.
Pedantically yours... ;-)