CoreMath

From GMLwiki

Jump to: navigation, search

This library provides basich mathematical functions for the GML Interpreter

aNormal chooses a unit vector v’ such that v v’ dot is zero, ie. v’ is perpendicular to v
abs b is ’a a mul sqrt’.
acos computes the inverse cosine function
add adds two elements
and returns 1 iff both a and b do not equal 0
asin computes the inverse sines function
atan computes the arcus tangens
atan2 returns the arctangent of y/x in the range -180 to 180
ceiling b equals a iff ’a 1.0 mod’ equals 0.0. otherwise b equals ’dup 1.0 mod sub 1 add’ except that it is an int
clamp clamps float t to the float interval
cos computes the cosine function
cross returns the cross product of u and v
determinant computes 2x2 or 3x3 determinant
dist d is the distance between points p0 and p1
div divides an number or point through a number.
exp computes the exp(a) exponential function (to basis e)
floor b equals a iff ’a 1.0 mod’ equals 0.0. otherwise b equals ’dup 1.0 mod sub’ except that it is an int.
getX get X component of a point
getY get Y Component of a point
getZ get Z Component of a point
inv inverts a number
ln computes the natural logarithm of a (basis e)
log computes the decimal logarithm of a
mod computes c as a modulo b
mul multiplies two objects which can be numbers or points
neg negates an object
normalize computes the unit length of a point
not returns 1 iff a equals 0 or 0.0
or returns 1 iff either a or b or both do not equal 0 (or 0.0)
pi returns 3.4159265359
planemul computes w = x*u + y*v
pow takes a to the power of b.
putX replaces a point’s x coordinate.
putY replaces a point’s y coordinate.
putZ replaces a point’s z coordinate.
random return random number
round rounds a float to the nearest integer
sin computes the sines function
sqrt computes the square root of a number.
sub substracts b from a
tan computes the tangens function
trunc chops off the decimal digits after the point
vector2 turns two numbers into a P2
vector3 turns three numbers into a P3
Personal tools