I was reading some posts on StackOverflow about representing a rotation from one vector to another (
Q=<→asinθ2,cosθ2>P=<→asinϕ2,cosϕ2>
The sum of the quaternions is
P+Q=<→a(sinθ2+sinϕ2),cosθ2+cosϕ2>
Let's normalize this quaternion, using the trigonometry identities
u=θ2v=ϕ2sinu+sinv=2sinu+v2cosu−v2cosu+cosv=2cosu+v2cosu−v2
For the norm of the quaternion we have
|P+Q|2=|→a|24sin2u+v2cos2u−v2+4cos2u+v2cos2u−v2==4|→a|2cos2u−v2(sin2u+v2+cos2u+v2)==4cos2u−v2|P+Q|=2cosu−v2
Dividing each quaternion component by the norm, gives us
<→a2sinu+v2cosu−v22cosu−v2,2cosu+v2cosu−v22cosu−v2>==<→asinu+v2,cosu+v2>==<→asinθ+ϕ4,cosθ+ϕ4>
which is exactly the quaternion for the rotation around axis →a by angle θ+ϕ2 - the angle halfway between θ and ϕ.
Finding quaternion representing the rotation from one vector to another ) when something caught my attention:
... calculate the quaternion which results, in twice the required rotation (as detailed in the other solution), and find the quaternion half-way between that and zero degrees. ... Calculating the half-way quaternion is simply a matter of summing the quaternions and normalizing the result, just like with vectors.
OK, I didn't remember anything about the geometrical interpretation of quaternion addition in my favourite references Real-time rendering or Physically Based Rendering: From Theory To Implementation .
Reached to the pencil ..
We have two unit quaternions, representing different rotations around the same axis:
The sum of the quaternions is
P+Q=<→a(sinθ2+sinϕ2),cosθ2+cosϕ2>
Let's normalize this quaternion, using the trigonometry identities
u=θ2v=ϕ2sinu+sinv=2sinu+v2cosu−v2cosu+cosv=2cosu+v2cosu−v2
For the norm of the quaternion we have
|P+Q|2=|→a|24sin2u+v2cos2u−v2+4cos2u+v2cos2u−v2==4|→a|2cos2u−v2(sin2u+v2+cos2u+v2)==4cos2u−v2|P+Q|=2cosu−v2
Dividing each quaternion component by the norm, gives us
<→a2sinu+v2cosu−v22cosu−v2,2cosu+v2cosu−v22cosu−v2>==<→asinu+v2,cosu+v2>==<→asinθ+ϕ4,cosθ+ϕ4>
which is exactly the quaternion for the rotation around axis →a by angle θ+ϕ2 - the angle halfway between θ and ϕ.
No comments:
Post a Comment