Difference between revisions of "Math"

From GiderosMobile
(add modf)
Line 28: Line 28:
 
[[math.max]] ''returns maximum in a list of one or more values''<br/><!--GIDEROSMTD:math.max(v1,...) returns maximum in a list of one or more values-->
 
[[math.max]] ''returns maximum in a list of one or more values''<br/><!--GIDEROSMTD:math.max(v1,...) returns maximum in a list of one or more values-->
 
[[math.min]] ''returns minimum in a list of one or more values''<br/><!--GIDEROSMTD:math.min(v1,...) returns minimum in a list of one or more values-->
 
[[math.min]] ''returns minimum in a list of one or more values''<br/><!--GIDEROSMTD:math.min(v1,...) returns minimum in a list of one or more values-->
 +
[[math.modf]] ''returns the integer and fractional values''<br/><!--GIDEROSMTD:math.modf(v1,v2) returns the integer and fractional values-->
 
[[math.pow]] ''returns v1 raised to the power of v2''<br/><!--GIDEROSMTD:math.pow(v1,v2) returns v1 raised to the power of v2-->
 
[[math.pow]] ''returns v1 raised to the power of v2''<br/><!--GIDEROSMTD:math.pow(v1,v2) returns v1 raised to the power of v2-->
 
[[math.rad]] ''returns angle in radians of degrees deg''<br/><!--GIDEROSMTD:math.rad(deg) returns angle in radians of degrees deg-->
 
[[math.rad]] ''returns angle in radians of degrees deg''<br/><!--GIDEROSMTD:math.rad(deg) returns angle in radians of degrees deg-->

Revision as of 10:16, 13 November 2022

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2011.6

Description

math table holds most commonly used math functions and constants.

Methods

math.abs returns absolute value of v
math.acos returns arc cosine value of v in radians
math.asin returns arc sine value of v in radians
math.atan returns arc tangent value of v in radians
math.atan2 returns arc tangent value of v1/v2 in radians
math.ceil returns smallest integer >= v
math.clamp returns a number between min and max, inclusive
math.cos returns cosine value of angle rad
math.deg returns angle in degrees of radians rad
math.exp returns e^v
math.floor returns largest integer <= v
math.fmod returns remainder of v1/v2 which is v1 - iV2 for some integer i
math.frexp returns mantissa [0.5,1- and exponent values of v
math.ldexp returns v1*2^v2
math.log returns natural logarithm of v
math.log10 returns logarithm 10 of v
math.max returns maximum in a list of one or more values
math.min returns minimum in a list of one or more values
math.modf returns the integer and fractional values
math.pow returns v1 raised to the power of v2
math.rad returns angle in radians of degrees deg
math.random returns random real [0,1-, integer [1,n] or real [1,u](with n=1-
math.randomseed sets seed for pseudo-random number generator
math.sin returns sine value of angle rad
math.sqrt returns square root of v
math.tan returns tangent value of angle rad
vector vectors

Gideros specific methods

math.length returns the length of a vector
math.cross returns the cross product of two vectors
math.dot returns the dot product of two vectors
math.distance returns the distance between two points
math.distances returns the distances between a point and a set of points
math.nearest returns the nearest point from a list
math.normalize normalize a vector
math.raycast returns intersections between a ray and a set of shapes
math.inside returns wether a point is inside a shape
math.edge returns the nearest point on the edge of a shape

Events

Constants

huge
pi