The Math library provides standard mathematical constants and functions for use in CursorScript.
Math.PI- 3.14159...Math.E- 2.71828...Math.TAU- 2 * PIMath.PHI- 1.618... (Golden Ratio)Math.SQRT2- Square root of 2
Math.abs(n)- Returns the absolute value ofn.Math.floor(n)- Returns the largest integer less than or equal ton.Math.ceil(n)- Returns the smallest integer greater than or equal ton.Math.round(n)- Returns the value ofnrounded to the nearest integer.Math.pow(base, exp)- Returnsbaseto the exponent powerexp.Math.sqrt(n)- Returns the square root ofn.Math.cbrt(n)- Returns the cube root ofn.Math.sin(rad)- Returns the sine of an angle (in radians).Math.cos(rad)- Returns the cosine of an angle (in radians).Math.tan(rad)- Returns the tangent of an angle (in radians).Math.sinDeg(deg)- Returns the sine of an angle (in degrees).Math.cosDeg(deg)- Returns the cosine of an angle (in degrees).Math.tanDeg(deg)- Returns the tangent of an angle (in degrees).Math.clamp(n, min, max)- Clampsnbetweenminandmax.Math.lerp(a, b, t)- Linearly interpolates betweenaandbbyt.Math.randomInt(min, max)- Returns a random integer betweenminandmax.