Math
class in OpalScript
Deterministic numeric helpers. Random is the only source of chance.
Properties
| Member | Description |
|---|---|
| Math.PI | Pi. |
Methods
| Member | Description |
|---|---|
| Math.Min | The smaller value. |
| Math.Max | The larger value. |
| Math.Clamp | Clamp a value between minimum and maximum. |
| Math.Abs | Absolute value. |
| Math.Sin | Sine of an angle in radians. |
| Math.Cos | Cosine of an angle in radians. |
| Math.Sqrt | Square root (a negative input faults). |
| Math.Pow | Raise a value to a power. |
| Math.Atan2 | The angle (radians) of the vector (x, y), given as Atan2(y, x). |
| Math.Floor | Round down to an int. |
| Math.Ceil | Round up to an int. |
| Math.Round | Round to the nearest int. |
| Math.Sign | -1, 0, or 1. |
| Math.Lerp | Lerp(a, b, t): the value t of the way from a to b. |
| Math.Random | Random(min, max): a random float in [min, max). |