It's not clear what you mean by "getting the rotation for that new Axis" - but 
I think I can answer, just not sure if it's answering what you are asking.  :-)

For starters to get the angle theta between two vectors a and b you use this 
identity.

Cos(theta) = dot(a, b)/(length(a)*length(b))

So now you can calculate the angle between your new vector (v1+v2)/2 and say 
vec1.

But I’m guessing you want to specify a rotation matrix that takes vec1 to the 
new vector. 

So rotations can all be thought of as some number of radians spin about a given 
axis.  So what is the axis of rotation then?  A: It’s the normal to the plane 
defined by the two vectors.

We can generate a vector that is mutually perpendicular to your two vectors 
vec1 and vec2 by using the cross product.  That’s the normal to the plane in 
question here.

There probably exists a function that spits out a rotation matrix given an axis 
and rotation amount.  Just use that, and plug in the theta you calculated, plus 
this new vector we calculated with the cross product.

Sorry I’m not providing you with the actual python code, I’ll leave that to 
you.  :-) but this is the roadmap to get there.



_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to