Skip to content

Math ​

class in OpalScript

Deterministic numeric helpers. Random is the only source of chance.

Properties ​

MemberDescription
Math.PIPi.

Methods ​

MemberDescription
Math.MinThe smaller value.
Math.MaxThe larger value.
Math.ClampClamp a value between minimum and maximum.
Math.AbsAbsolute value.
Math.SinSine of an angle in radians.
Math.CosCosine of an angle in radians.
Math.SqrtSquare root (a negative input faults).
Math.PowRaise a value to a power.
Math.Atan2The angle (radians) of the vector (x, y), given as Atan2(y, x).
Math.FloorRound down to an int.
Math.CeilRound up to an int.
Math.RoundRound to the nearest int.
Math.Sign-1, 0, or 1.
Math.LerpLerp(a, b, t): the value t of the way from a to b.
Math.RandomRandom(min, max): a random float in [min, max).

See also ​