How to do this?
Below is my particular use case and attempt to solve the problem:
Consider Z_axis = (0,0,1) and an arbitrary point also on the unit sphere v.
You can imagine the arc on the surface of the sphere from Z_axis to v.
I wish to create v' by extending the arc by 10%.
How can I do this from Python?
Here is as far as I have got:
unit_v = v.normalized() rot_axis = Z_axis.cross(unit_v)
...will give a vector perpendicular to rotation plane, and
theta = arcsin( abs(rot_axis) ) # <-- some potential problem with positive and negative angles here I think
...will return the angle.
So I was just need to rotate unit_v by theta' = 0.1*theta around rot_axis
How do I do this?
I can construct a Quaternion Q representing the rotation:
w = cos( theta'/2 ) x,y,z = sin( theta'/2 ) * rot_axis.normalized() Q = Quaternion(( w,x,y,z ))
unit_v' = unit_v.rotate(Q) v' = abs(v) * unit_v'
Is this correct, and is there a cleaner way?