(也许这对于数学堆栈交换更好?)
我有一条由骨头组成的链条。每根骨头都有一个带尖和尾巴的。以下代码在给定旋转的情况下计算其尖端的位置,并适当地设置链位置中的下一个链接:
// Quaternion is a hand-rolled class that works correctly (as far as I can tell.)
Quaternion quat = new Quaternion(getRotationAngleDegrees(), getRotation());
// figure out where the tip will be after applying the rotation
Vector3f rotatedTip = quat.applyRotationTo(tip);
// set the next bone's tail to be at this one's tip
updateNextPosFrom(rotatedTip);
如果旋转应该围绕对象坐标系的原点发生,则此方法有效。但是,如果我希望围绕对象中的其他任意点进行旋转怎么办?我不确定如何翻译四元数。最好的方法是什么?
(我正在使用 JOGL / OpenGL。)