Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.34 KB

File metadata and controls

30 lines (25 loc) · 1.34 KB

Math Library (Math)

The Math library provides standard mathematical constants and functions for use in CursorScript.

Constants

  • Math.PI - 3.14159...
  • Math.E - 2.71828...
  • Math.TAU - 2 * PI
  • Math.PHI - 1.618... (Golden Ratio)
  • Math.SQRT2 - Square root of 2

Functions

  • Math.abs(n) - Returns the absolute value of n.
  • Math.floor(n) - Returns the largest integer less than or equal to n.
  • Math.ceil(n) - Returns the smallest integer greater than or equal to n.
  • Math.round(n) - Returns the value of n rounded to the nearest integer.
  • Math.pow(base, exp) - Returns base to the exponent power exp.
  • Math.sqrt(n) - Returns the square root of n.
  • Math.cbrt(n) - Returns the cube root of n.
  • 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) - Clamps n between min and max.
  • Math.lerp(a, b, t) - Linearly interpolates between a and b by t.
  • Math.randomInt(min, max) - Returns a random integer between min and max.