Trigonometry Conversion Operators: Difference between revisions

From GiderosMobile
formatting
Line 8: Line 8:


=== <translate>Description</translate> ===
=== <translate>Description</translate> ===
<translate>
Operators to convert from one type of measurement to another.
Operators to convert from one type of measurement to another.<br />


<b> ^&lt; </b>deg &emsp; Convert 'deg' into radians.<br />
'''^<''' deg &emsp; Convert 'deg' into radians.<br/>
<b> ^&gt; </b>rad &emsp; Convert 'rad' into degrees.<br />
'''^>''' rad &emsp; Convert 'rad' into degrees.<br/>
</translate>


=== <translate>Examples</translate> ===
=== <translate>Examples</translate> ===
'''Simple degree to radian (^<) examples:'''<br/>
'''Simple degree to radian (^<) examples:'''
<code>
<source lang="lua">
r=^&lt;d -- faster than r=math.rad(d)<br/>
r=^<d -- faster than r=math.rad(d)
radAngle=^&lt;sprite:getRotation()<br/>
radAngle=^<sprite:getRotation()
pi=^&lt;180 -- pi is 3.142 in radians or 180 in degrees
pi=^<180 -- pi is 3.142 in radians or 180 in degrees
</code><br/>
</source>


'''Simple radian to degree (^>) examples:'''<br/>
'''Simple radian to degree (^>) examples:'''
<code>  
<source lang="lua">
d=^&gt;r -- faster than d=math.deg(r)<br/>
d=^>r -- faster than d=math.deg(r)
sprite:setRotation(^&gt;math.sin(0.5))
sprite:setRotation(^>math.sin(0.5))
</code><br/>
</source>


{|-
{|-
| style="width: 50%; vertical-align:top;"|
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
=== <translate>Methods</translate> ===
| style="width: 50%; vertical-align:top;"|
| style="width: 50%; vertical-align:top;"|

Revision as of 04:57, 28 January 2020



Supported platforms:
Available since: Gideros 2017.10

Description

Operators to convert from one type of measurement to another.

^< deg   Convert 'deg' into radians.
^> rad   Convert 'rad' into degrees.

Examples

Simple degree to radian (^<) examples:

r=^<d -- faster than r=math.rad(d)
radAngle=^<sprite:getRotation()
pi=^<180 -- pi is 3.142 in radians or 180 in degrees

Simple radian to degree (^>) examples:

d=^>r -- faster than d=math.deg(r)
sprite:setRotation(^>math.sin(0.5))

Methods

Events

Constants