Radians/draft: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Blocco
No edit summary
>Legend26
No edit summary
Line 10: Line 10:
== How do we use them? ==
== How do we use them? ==


Radians and degrees can be used interchangebly, as there is a formula to convert between the two.  This formula can be found by observing the <code>math.rad</code> and <code>math.deg</code> functions, as they convert degrees into radians, and vice versa.
Radians and degrees can be used interchangebly, as there is a formula to convert between the two.  This formula can be found by observing the {{`|math.rad}} and {{`|math.deg}} functions, as they convert degrees into radians, and vice versa.


Most people like using degrees for complicated angles, and in Roblox, most people will use degrees to simplify the CFrame that they are using.
Most people like using degrees for complicated angles, and in Roblox, most people will use degrees to simplify the CFrame that they are using.
Line 16: Line 16:
=== Radians ===
=== Radians ===


Radians can be used in Roblox by using the function <code>math.rad</code> and inputting a value in degrees.  That function will output the correct converted value from degrees to radians.  From this, the CFrame function <code>CFrame.Angles</code> (which only uses radians for it's input) can create a rotation for a CFrame.
Radians can be used in Roblox by using the function {{`|math.rad}} and inputting a value in degrees.  That function will output the correct converted value from degrees to radians.  From this, the CFrame function {{`|CFrame.Angles}} (which only uses radians for it's input) can create a rotation for a CFrame.


== Advanced ==
== Advanced ==
Line 24: Line 24:
For example:
For example:


<code>
0 Degrees => 0 radians<br>
0 Degrees => 0 radians<br>
1 Degree => 0.017453292519943295769236907684886 Radians<br>
1 Degree => 0.017453292519943295769236907684886 Radians
2 Degrees => 0.034906585039886591538473815369772 Radians<br>
2 Degrees => 0.034906585039886591538473815369772 Radians
3 Degrees => 0.052359877559829887307710723054658 Radians<br>
3 Degrees => 0.052359877559829887307710723054658 Radians
4 Degrees => 0.069813170079773183076947630739545 Radians<br>
4 Degrees => 0.069813170079773183076947630739545 Radians
</code>


And the reverse:<br>
And the reverse:
1 Radian => 57.295779513082320876798154814105 Degrees<br>
2 Radians => 114.59155902616464175359630962821 Degrees<br>
3 Radians => 171.88733853924696263039446444232 Degrees<br>
4 Radians => 229.18311805232928350719261925642 Degrees<br>


And so on.  You can convert Degrees to Radians and Radians to Degrees using [http://www.10ticks.co.uk/radianConverter.aspx online conversion tools], with your calculator, or with the following functions:
<code>
1 Radian => 57.295779513082320876798154814105 Degrees
2 Radians => 114.59155902616464175359630962821 Degrees
3 Radians => 171.88733853924696263039446444232 Degrees
4 Radians => 229.18311805232928350719261925642 Degrees
</code>
 
And so on.  You can convert Degrees to Radians and Radians to Degrees using [http://www.10ticks.co.uk/radianConverter.aspx online conversion tools], with your calculator, or with the following number and functions:


math.pi<br>
math.pi<br>
Roblox reads this as Pi, which is 3.141592654.<br>
Roblox reads this as Pi, which is approximately 3.141592654.


math.rad (x)<br>
math.rad (x)<br>
Converts x (in degrees) into Radians. Example: math.rad(90) results in  1.5707963267.<br>
Converts x (in degrees) into Radians. Example: math.rad(90) results in  1.5707963267.


math.deg (x)<br>
math.deg (x)<br>
Converts x (in Radians) into degrees. Example: math.deg(3.141592654) results in 180.<br>
Converts x (in Radians) into degrees. Example: math.deg(3.141592654) results in 180.


== See Also ==
== See Also ==

Revision as of 19:03, 24 March 2012

This article is about an advanced topic.

Radians and degrees are units of measurement for angles. You use radians for many things, like figuring out the size of an angle on a triangle, denoting and using rotations and other cool stuff.

Why do we need them?

Radians and degrees are simple a way to use and describe angles with specific numbers. They are used a lot in real life and help us calculate how to build something correctly. You can even use them on Roblox to make cool CFramed art.

How do we use them?

Radians and degrees can be used interchangebly, as there is a formula to convert between the two. This formula can be found by observing the math.rad and math.deg functions, as they convert degrees into radians, and vice versa.

Most people like using degrees for complicated angles, and in Roblox, most people will use degrees to simplify the CFrame that they are using.

Radians

Radians can be used in Roblox by using the function math.rad and inputting a value in degrees. That function will output the correct converted value from degrees to radians. From this, the CFrame function CFrame.Angles (which only uses radians for it's input) can create a rotation for a CFrame.

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:

0 Degrees => 0 radians
1 Degree => 0.017453292519943295769236907684886 Radians 2 Degrees => 0.034906585039886591538473815369772 Radians 3 Degrees => 0.052359877559829887307710723054658 Radians 4 Degrees => 0.069813170079773183076947630739545 Radians

And the reverse:

1 Radian => 57.295779513082320876798154814105 Degrees 2 Radians => 114.59155902616464175359630962821 Degrees 3 Radians => 171.88733853924696263039446444232 Degrees 4 Radians => 229.18311805232928350719261925642 Degrees

And so on. You can convert Degrees to Radians and Radians to Degrees using online conversion tools, with your calculator, or with the following number and functions:

math.pi
Roblox reads this as Pi, which is approximately 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.

See Also

Radians

Degrees

Radian Degree Converter

Table of polyhedron dihedral angles