问题描述
鉴于四元数的值,我想在一组四元数中找到它的最接近的邻居.为此,我显然需要一种方法来比较两个四元数之间的距离".这样的比较需要什么距离表示以及如何计算?
Given a quaternion value, I would like to find its nearest neighbour in a set of quaternions. To do this, I clearly need a way to compare the "distance" between two quaternions. What distance representation is needed for such a comparison and how is it computed?
谢谢
乔什
推荐答案
您的四元数只是3D空间中具有方向的一个点吗?
Is your quaternion just a point in 3D space with an orientation?
然后,两个四元数x1,y1,z1,w1
和x2,y2,x2,w2
之间的距离由下式给出:
Then the distance between two quaternions x1,y1,z1,w1
and x2,y2,x2,w2
is given by:
distance = sqrt((x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2)
,假定w
组件用于定向. IE.这与两个3D点之间的距离相同.
distance = sqrt((x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2)
, assuming that the w
component is used for orientation. I.e. this is the same as the distance between two 3D points.
您的四元数在4D空间中是一个点吗?
Is your quaternion a point in 4D space?
然后它们之间的距离由下式给出:
Then the distance between them is given by:
distance = sqrt((x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2 + (w1-w2)^2)
.
这只是4D空间的扩展.此欧几里德距离公式可以在任意维度上使用.
Which is just the extension to 4D space. This euclidean distance formula works in any number of dimensions.
这篇关于使用四元数的最近邻居的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!