Difference between revisions of "Trigonometry Conversion Operators"
From GiderosMobile
m (→Examples) |
(formatting) |
||
Line 8: | Line 8: | ||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
− | + | Operators to convert from one type of measurement to another. | |
− | Operators to convert from one type of measurement to another. | ||
− | + | '''^<''' deg   Convert 'deg' into radians.<br/> | |
− | + | '''^>''' rad   Convert 'rad' into degrees.<br/> | |
− | |||
=== <translate>Examples</translate> === | === <translate>Examples</translate> === | ||
− | '''Simple degree to radian (^<) examples:''' | + | '''Simple degree to radian (^<) examples:''' |
− | < | + | <source lang="lua"> |
− | r=^ | + | r=^<d -- faster than r=math.rad(d) |
− | radAngle=^ | + | radAngle=^<sprite:getRotation() |
− | pi=^ | + | pi=^<180 -- pi is 3.142 in radians or 180 in degrees |
− | </ | + | </source> |
− | '''Simple radian to degree (^>) examples:''' | + | '''Simple radian to degree (^>) examples:''' |
− | < | + | <source lang="lua"> |
− | d=^ | + | d=^>r -- faster than d=math.deg(r) |
− | sprite:setRotation(^ | + | sprite:setRotation(^>math.sin(0.5)) |
− | </ | + | </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 05: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 |
EventsConstants |