给定一个轴的向量,如何找到其他两个轴的向量? [英] Given vector of one axis, how do I find vectors of other two axes?

查看:147
本文介绍了给定一个轴的向量,如何找到其他两个轴的向量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个数学问题,我不确定该怎么做.向量没有与轴对齐,因此仅绕x,y或z旋转90度并不一定会给我其他轴.

This is a maths problem I am not exactly sure how to do. The vector is not aligned to an axis, so just rotating 90 degrees around x, y or z won't necessarily give me the other axes.

推荐答案

我可以想到您可能要问的几种不同情况.

I can think of a couple of different scenarios you might be asking about.

给出:一个预先存在的坐标系

  • 在2D系统中,您的轴/基础始终为[1,0][0,1]- x y 轴.

在3D系统中,您的轴/基准始终为[1,0,0][0,1,0][0,0,1]- x y z .

In a 3D system, your axes/basis are always [1,0,0], [0,1,0], and [0,0,1] -- x, y, and z.

给出:任意基本2D坐标系中的一个轴

如果一个轴在任意基础的2D坐标系中,则另一个轴为正交向量.

If you have one axis in an arbitrary-basis 2D coordinate system, the other axis is the orthogonal vector.

要正交地逆时针旋转矢量:

[x_new, y_new] = [ -y_old, x_old]

顺时针正交旋转矢量:

[x_new, y_new] = [ y_old, -x_old]

总结:

Given: x-axis = [ a,  b]
Then:  y-axis = [-b,  a]

Given: y-axis = [ c,  d]
Then:  x-axis = [ d, -c]


给出:任意基本3D坐标系中的两个轴

为此,找到叉积.

[a,b,c] x [d,e,f] = [ b*f - c*e, c*d - a*f, a*e - b*d ]

遵循以下三个准则:

  • ( x 轴)x( y 轴)=( z 轴)
  • ( y 轴)x( z 轴)=( x 轴)
  • ( z 轴)x( x 轴)=( y 轴)
  • (x axis) x (y axis) = (z axis)
  • (y axis) x (z axis) = (x axis)
  • (z axis) x (x axis) = (y axis)

给出:任意基本3D坐标系中的一个轴

没有足够的信息来找到此问题的唯一解决方案.这是因为,如果查看第二种情况(任意基2D坐标系中的一个轴),则首先需要找到正交向量.但是,在3D空间中,单轴有无限可能的正交矢量!

There is not enough information to find the unique solution this problem. This is because, if you look at the second case (One axis in an arbitrary-basis 2D coordinate system), you first need to find an orthogonal vector. However, there are an infinite amount of possible orthogonal vectors to a single axis in 3D space!

但是,您可以找到一种可能的解决方案.

You can, however, find one of the possible solutions.

一种通过找到任意向量[d,e,f]来找到这些正交向量中任意一个的一种方法,其中:

One way to find an arbitrary one of these orthogonal vectors by finding any vector [d,e,f] where:

[a,b,c] = original axis
[d,e,f] = arbitrary orthogonal axis (cannot be [0,0,0])

a*d + b*e + c*f = 0

例如,如果原始轴为[2,3,4],则可以解决:

For example, if your original axis is [2,3,4], you'd solve:

2 * d + 3 * e + 4 * f = 0

也就是说,满足此条件的[d,e,f] any 值是令人满意的正交向量(只要不是[0,0,0]).例如,可以选择[3,-2,0]:

That is, any value of [d,e,f] that satisfies this is a satisfactory orthogonal vector (as long as it's not [0,0,0]). One could pick, for example, [3,-2,0]:

2 * 3 + 3 *-2 + 4 * 0 = 0
  6   +  -6   +   0   = 0

如您所见,一个适用的公式"是[d,e,f] = [b,-a,0] ...但是还有许多其他公式也可以适用.实际上,是无限的!

As you can see, one "formula" that works to is [d,e,f] = [b,-a,0]...but there are many other ones that can work as well; there are, in fact, an infinite!

找到两个轴[a,b,c][d,e,f]后,可以将[a,b,c][d,e,f]用作x和y轴(或您所选择的任何轴),将其减少到以前的情况(情况3)需要它们,以解决您的特定问题.

Once you find your two axes [a,b,c] and [d,e,f], you can reduce this back to the previous case (case 3), using [a,b,c] and [d,e,f] as your x and y axes (or whatever axes you need them to be, for your specific problem).

标准化

请注意,随着您不断进行点积和叉积,向量将开始变得越来越大.取决于您想要什么,这可能是不希望的.例如,您可能希望基向量(坐标轴)都具有相同的大小/长度.

Note that, as you continually do dot products and cross products, your vectors will begin to grow larger and larger. Depending on what you want, this might not be desired. For example, you might want your basis vectors (your coordinate axes) to all be the same size/length.

要将任何矢量([0,0,0]除外)转换为单位矢量(长度为1的矢量,与原始矢量的方向相同):

To turn any vector (except for [0,0,0]) into a unit vector (a vector with a length of 1, in the same direction as the original vector):

r  = [a,b,c]   
v  = Sqrt(a^2 + b^2 + c^2)   <-- this is the length of the original vector
r' = [ a/v , b/v , c/v ]

其中r'表示r的单位向量-长度为1的向量,指向与r相同的方向.一个例子:

Where r' represents the unit vector of r -- a vector with length of 1 that points in the same direction as r does. An example:

r  = [1,2,3]
v  = Sqrt(1^2 + 2^2 + 3^2) = Sqrt(13) = 3.60555  <-- this is the length of the original vector
r' = [0.27735, 0.55470, 0.83205]

现在,例如,如果我想要一个与r方向相同,长度为5的矢量,我只需乘以r' * 5,即[a' * 5, b' * 5, c' * 5].

Now, if I wanted, for example, a vector in the same direction of r with a length of 5, I'd simply multiply out r' * 5, which is [a' * 5, b' * 5, c' * 5].

这篇关于给定一个轴的向量,如何找到其他两个轴的向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆