Radians
This is a very basic explanation of Radians, if you have never been taught Radians before.
Radians are another way of describing angles, as opposed to using degrees. Something similar to Radians is used in everyday life, when we use fractions. We say, "I want a third of a piece of cake," not, "I want 120 degrees worth of cake."
In this sense, we are using the concept of "[turns]". There is one turn in a full circle, so 1 turn is 160°. It follows that 180° is half a turn, 90° is a quarter turn, and so on.
Conversion
One turn is equal to 2π radians. Therefore, 2π radians = 360°. From this, formulae for converting degrees to radians, and vice versa, can be found:
In Lua terms, these can be written as:
local radians = degrees * math.pi / 180 local degrees = radians * math.pi / 180
However, there is a cleaner way of doing this. Lua provides functions to do these conversions for you in the math library:
local radians = math.rad(degrees) local degrees = math.deg(radians)
...
For a basic idea of Radians to how much "cake" or "circle" you have, divide the radians by "2 pi". To convert how much "cake" or "circle" you have to Radians, multiply the "cake" (or circle) by "2 pi":
Angle in radians | represents |
---|---|
2π | one whole circle |
π | one-half circle |
2π/3 | one-third circle |
pi/2 | one fourth circle |
2pi/5 | one-fifth circle |
pi/3 | one-sixth circle |
2pi/7 | one-seventh circle |
pi/4 | one-eighth circle |
2pi/9 | one-ninth circle |
pi/5 | one-tenth circle |
2pi/11 | one-eleventh circle |
pi/6 | one-twelfth circle |
0 | No circle |
Degrees slice a circle into 360 parts -- and sometimes degrees need to be converted into Radians. To convert from degrees to radians, divide by (180/pi). To convert from radians to degrees, multiply by (180/pi).
For example:
360 Degrees || 2pi radians
270 Degrees || 3pi/2 radians
180 Degrees || pi radians
90 Degrees || pi/2 radians
60 Degrees || pi/3 radians
45 Degrees || pi/4 radians
30 Degrees || pi/6 radians
0 Degrees || 0 radians
Advanced
The above examples have used whole numbers and rather clean fractions. Unfortunately, if you want to make something like a "spiralling staircase", you will need to work with much finer "pie slices" than the ones above, and you will get decimals. However, the principle and the computation is the same:
For example:
Degrees | Radians |
---|---|
0 | 0 |
1 | 0.017453292519943295769236907684886 |
2 | 0.034906585039886591538473815369772 |
3 | 0.052359877559829887307710723054658 |
4 | 0.069813170079773183076947630739545 |
And the reverse:
Radians | Degrees |
---|---|
1 Radian | 57.295779513082320876798154814105 |
2 Radians | 114.59155902616464175359630962821 |
3 Radians | 171.88733853924696263039446444232 |
4 Radians | 229.18311805232928350719261925642 |
And so on. You can convert Degrees to Radians and Radians to Degrees using online conversion tools, with your calculator, or with the following functions:
math.pi
Roblox reads this as Pi, which is 3.141592654.
math.rad (x)
Converts x (in degrees) into Radians. Example: math.rad(90) results in 1.5707963267.
math.deg (x)
Converts x (in Radians) into degrees. Example: math.deg(3.141592654) results in 180.