Real-Time Rendering——4.2.4 Rotation about an Arbitrary Axis

we first transform to a space where the axis around which we want to rotate is the x-axis. This is done with a rotation matrix, called M. Then the actual rotation is performed, and we transform back using M−1. This procedure is illustrated in Figure 4.8.

我们首先变换到一个空间,我们要绕其旋转的轴是x轴。这是通过一个称为M的旋转矩阵来完成的,然后执行实际的旋转,我们使用M的逆函数进行反变换。这个过程如图4.8所示。

围绕任意轴r的旋转是通过找到由r、s和t形成的正交基来实现的。然后我们将这个基与标准基对齐,以便r与x轴对齐。围绕x轴的旋转在那里进行,最后我们转换回来。

To compute M, we need to find two axes that are orthonormal both to r and to each other. We concentrate on finding the second axis, s, knowing that the third axis,t, will be the cross product of the first and the second axis, t = r × s. A numerically stable way to do this is to find the smallest component (in absolute value) of r, and set it to 0.Swap the two remaining components, and then negate the first of them (in fact, either of the nonzero components could be negated). Mathematically, this is expressed as:

为了计算M,我们需要找到两个正交于r和彼此的轴。我们专注于寻找第二个轴s,知道第三个轴t将是第一个轴和第二个轴t = r × s的叉积,一个数值稳定的方法是找到r的最小分量(绝对值),并将其设置为0。交换剩下的两个分量,然后乘负第一个分量(事实上,任何一个非零分量都可以被乘负)。数学上,这表示为:

This guarantees that ¯s is orthogonal (perpendicular) to r, and that (r, s, t) is an orthonormal basis. Frisvad [496] presents a method without any branches in the code,which is faster but has lower accuracy. Max [1147] and Duff et al. [388] improve the accuracy of Frisvad’s method. Whichever technique is employed, these three vectors are used to create a rotation matrix:

 

这保证了¯s与r正交(垂直),并且(r,s,t)是正交基。Frisvad [496]提出了一种在代码中没有任何分支的方法,这种方法速度更快,但精度更低。Max [1147]和Duff等[388]提高了Frisvad方法的精度。无论采用哪种技术,这三个向量都用于创建旋转矩阵:

This matrix transforms the vector r into the x-axis, s into the y-axis, and t into the z-axis. So, the final transform for rotating α radians around the normalized vector r is then

 这个矩阵将向量r转换成x轴,s转换成y轴,t转换成z轴。因此,围绕归一化向量r旋转α弧度的最终变换是

In words, this means that first we transform so that r is the x-axis (using M), then we rotate α radians around this x-axis (using Rx(α)), and then we transform back using the inverse of M, which in this case is MT because M is orthogonal. 

换句话说,这意味着首先我们变换,使r是x轴(使用M),然后我们围绕这个x轴旋转α弧度(使用Rx(α)),然后我们使用M的逆变换回来,在这种情况下是MT,因为M是正交的。

Another method for rotating around an arbitrary, normalized axis r by φ radians has been presented by Goldman [550]. Here, we simply present his transform:

高盛[550]提出了另一种绕任意归一化轴r旋转φ弧度的方法。在这里,我们简单介绍一下他的转变:

In Section 4.3.2, we present yet another method for solving this problem, using quaternions.
Also in that section are more efficient algorithms for related problems, such as rotation from one vector to another. 

在第4.3.2节中,我们提出了另一种解决这个问题的方法,使用四元数。 在这一节中,还介绍了解决相关问题的更有效的算法,例如从一个向量到另一个向量的旋转。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

椰子糖莫莫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值