Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Vector3D angleTo function returning wrong result

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
j.han97
220 Views, 2 Replies

Vector3D angleTo function returning wrong result

Hi all,

 

Just a very simple problem here. I have defined two vectors, which are the unit vectors in x- and z-directions respectively.

vec_1 = adsk.core.Vector3D.create(1, 0, 0)
vec_2 = adsk.core.Vector3D.create(0, 0, 1)

I expected the angle between these vectors are 90 degrees, which is 0.7854 radian. However, when I used the angleTo function to obtain the result,

vec_1.angleTo(vec_2)

It returned 1.5708 (radian), which is 180 degrees.

 

Did I miss something or could anyone tell me what is wrong here?

 

Thank you very much in advance.

Labels (1)
2 REPLIES 2
Message 2 of 3
BrianEkins
in reply to: j.han97

You're just a bit mixed up on the relationship between degrees and radians.  π radians (3.14159) = 180 degrees, so the answer you're getting of 1.5708 radians is 90 degrees.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3
j.han97
in reply to: BrianEkins

Wow, what a stupid mistake from me. Thank you so much Brian.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report