It does, but you're not giving many constraints so you'll have to deal
with the general case. Since your three vectors have no actual
relationship between them, and if i understand correctly that the axis
of rotation is the major constraint, you need to wrangle them like this:

A' = Project A onto plane defined by normal C B' = Project B onto plane
defined by normal C and then angleBetween (A', B')

If A' == A, but B' != B or vice versa, you can't get a clean solve since
you're either trying rotate on a plane that doesn't contain B (A==A, but
B' != B) or your source vector doesn't lie on the correct starting plane
(A' != A). Either way you need to crunch your source and target vectors
down so it becomes a straightforward angle problem.

Does that help any? I'm mangling some data (well, building a mesh) right
now but in my head this is how I'd attack the problem. If my 3D maths
isn't too rusty, i haven't forgotten anything.




On Tue, Nov 4, 2014, at 02:01 AM, sam williams wrote:
>> the 'angleBetween' gives you the angle you should rotate vector 1 to
>> so that it aligns perfectly with vector 2. In my example vector 1 can
>> only partially point in the direction of vector 2 because its only
>> allowed to rotate around a specific axis (in my example (0,1,0))
>
> see it like vector 1 is the metal arm on a compass and vector 2 is
> magnetically pulling it in its direction. But obviously the compass
> arm cannot leave its axis, but it still points in the direction of
> vector 2 as much as it can within its circle of rotation. The other
> vector maybe pointing anywhere. I just need a formula that will
> calculate how many degrees the compass arm needs to rotate to be
> pointing at vector 2 (within its axis).
>
> does this make more sense? Sam

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/1415077031.2874332.186751973.40B0D4DC%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to