Vector3D angleTo function returning wrong result

Vector3D angleTo function returning wrong result

j.han97
Advocate Advocate
700 Views
2 Replies
Message 1 of 3

Vector3D angleTo function returning wrong result

j.han97
Advocate
Advocate

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.

0 Likes
Accepted solutions (1)
701 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor
Accepted solution

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
Advocate
Advocate

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

0 Likes