CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 07-30-2004, 08:18 PM   #1
Anywhere but here..
fabman's Avatar
from hell
somewhere, España
Join Date: Aug 2002
Posts: 201
How to find the angle betwen two vectors

I got two vectors A and B as Point3, how could I find the 3 eulerangles between them, I look in the manual but I can't find a "simple" method to do it.
What I wan't to do is to copy the result rotation on to other object rotations.

Thank you in advance.
Mathematics, rightly viewed, possesses not only truth, but supreme beauty - a beauty cold and austere, like that of sculpture.
Old 07-30-2004, 10:02 PM   #2
lechoo's Avatar
Join Date: May 2004
Posts: 117
I think you can use quats. Here's my idea: calculate cross product of A and B. Put its x,y,z into quat's x,y,z. Thats your rotation vector, now you need angle. Equation is very simple:
ang = acos((A.x*B.x+A.y*B.y+A.z*B.z) / ((length A)*(length B))). ang is w part of quat. Now simply convert quat to eulerangles using "as eulerangles". I think it should work but never tried that.
Old 07-30-2004, 10:45 PM   #3
Join Date: Aug 2003
Posts: 230
Look up "Dot Product" in the MS reference manual.
Old 08-02-2004, 09:30 AM   #4
Demon Onion Slayer
Wahooney's Avatar
Keith Boshoff
3D Artist - Programmer - Scribe - Blender Wannabe - Max Enthusiast
Durban, South Africa
Join Date: May 2004
Posts: 976
Send a message via MSN to Wahooney
There is actually only one angle between two vectors (in relation to eachother). You can get that value like this:

ang = acos (dot vec1 vec2)

Note that the vectors must be normalized.

To get the angle of a vector in worldspace you're gonna hafta use some trig.
Old 01-18-2006, 09:00 PM   #5
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,479
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 06:35 PM.

Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.