Difference between revisions of "Trigonometry Conversion Operators"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''<translate>Supported platforms</translate>:''' [[File:Platform android]][[File:Platform ios]][[File:Platform mac]][[File:Platform pc]]<br/>
+
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2017.10<br/>
+
'''Available since:''' Gideros 2017.10<br/>
=== <translate>Description</translate> ===
 
<translate><br />
 
Operators to convert from one type of measurement to another.<br /><br />
 
  
<b> ^&lt; </b>deg &emsp; Convert 'deg' into radians.<br />
+
=== Description ===
<b> ^&gt; </b>rad &emsp; Convert 'rad' into degrees.<br /></translate>
+
Operators to convert from one type of measurement to another.
=== <translate>Examples</translate> ===
+
 
'''Simple ^< examples'''<br/>
+
'''^<''' deg &emsp; Convert 'deg' into radians<br/>
<source lang="lua">  
+
'''^>''' rad &emsp; Convert 'rad' into degrees<br/>
r=^&lt;d -- faster than r=math.rad(d)
+
 
radAngle=^&lt;sprite:getRotation()
+
=== Examples ===
pi=^&lt;180 -- pi is 3.142 in radians or 180 in degrees</source>
+
'''Simple degree to radian (^<) examples'''
'''Simple ^> examples'''<br/>
+
<syntaxhighlight lang="lua">
<source lang="lua">  
+
r=^<d -- faster than r=math.rad(d)
d=^&gt;r -- faster than d=math.deg(r)
+
radAngle=^<sprite:getRotation()
sprite:setRotation(^&gt;math.sin(0.5))</source>
+
pi=^<180 -- pi is 3.142 in radians or 180 in degrees
{|-
+
</syntaxhighlight>
| style="width: 50%; vertical-align:top;"|
+
 
=== <translate>Methods</translate> ===
+
'''Simple radian to degree (^>) examples'''
| style="width: 50%; vertical-align:top;"|
+
<syntaxhighlight lang="lua">
=== <translate>Events</translate> ===
+
d=^>r -- faster than d=math.deg(r)
=== <translate>Constants</translate> ===
+
sprite:setRotation(^>math.sin(0.5))
|}
+
</syntaxhighlight>
 +
 
 +
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 14:33, 13 July 2023

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.png
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))