Difference between revisions of "Trigonometry Conversion Operators"
From GiderosMobile
| Line 3: | Line 3: | ||
'''Available since:''' Gideros 2017.10<br/>  | '''Available since:''' Gideros 2017.10<br/>  | ||
=== Description ===  | === Description ===  | ||
| − | <br />  | + | <translate><br />  | 
Operators to convert from one type of measurement to another.<br /><br />  | Operators to convert from one type of measurement to another.<br /><br />  | ||
<b> ^< </b>deg   Convert 'deg' into radians.<br />  | <b> ^< </b>deg   Convert 'deg' into radians.<br />  | ||
| − | <b> ^> </b>rad   Convert 'rad' into degrees.<br />  | + | <b> ^> </b>rad   Convert 'rad' into degrees.<br /></translate>  | 
=== Examples ===  | === Examples ===  | ||
'''Simple ^< examples'''<br/>  | '''Simple ^< examples'''<br/>  | ||
| − | <source lang="lua"  | + | <source lang="lua">    | 
r=^<d -- faster than r=math.rad(d)  | r=^<d -- faster than r=math.rad(d)  | ||
radAngle=^<sprite:getRotation()  | radAngle=^<sprite:getRotation()  | ||
pi=^<180 -- pi is 3.142 in radians or 180 in degrees</source>  | pi=^<180 -- pi is 3.142 in radians or 180 in degrees</source>  | ||
'''Simple ^> examples'''<br/>  | '''Simple ^> examples'''<br/>  | ||
| − | <source lang="lua"  | + | <source lang="lua">    | 
d=^>r -- faster than d=math.deg(r)  | d=^>r -- faster than d=math.deg(r)  | ||
sprite:setRotation(^>math.sin(0.5))</source>  | sprite:setRotation(^>math.sin(0.5))</source>  | ||
Revision as of 13:33, 23 August 2018
Supported platforms: android, ios, mac, pc
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 ^< 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 ^> examples
 
d=^>r -- faster than d=math.deg(r)
sprite:setRotation(^>math.sin(0.5))
Methods | 
EventsConstants |