How to convert the cosine of a angle from radians to degrees

Hallo dear community,

I need a little help and sorry for the dumb question.

I need the calculation of the cosine of angles, but in degrees, and GH works only with radians.
I try to convert from Radians to Degrees, but the result is not exact. In this fall the cos (80) should be 0.17°

Any advice??
Thanks and best reagards

As you correctly state above, Grasshopper expects radians instead of degrees for trigonometrical operations. Degrees are for humans, computers prefer radians.

The cosine of 1.3962 radians is 0.1736 rad, but the cosine of 80 rad is cos(80 \% 2π) = cos(4.6017) = -0.1103 rad.
Here the \%-symbol represent the modulo operator, which calculates the remainder of a dividend and divisor value, what is “left over”. Since (i.e. 360°) is a full rotation around an imaginary circle, 80 rad represents 80 / 2π = 6.28, 6 full rotations plus an unfinished one. The cosine however is equal to the last rotation that is smaller than . Its angle is 4.6017rad.

You mismatch component you have to use Radians component and not Degrees to transform 80 deg in radians!

1 Like

Thanks for the help and for your time!!

1 Like

Hi John,

That isn’t strictly true (although probably good practise): you can flag input fields as taking degrees by right clicking on them and selecting the degree option (where available) resulting in (a) below.

Also, in formulae where you can’t, you can optionally use the rad() function inline, instead of the external Radians component, as at (b).


1 Like