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
Message 1 of 3
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)

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.

Tags (2)
Labels (1)
2 REPLIES 2
Message 2 of 3

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