Variable MathUtilsConst

MathUtils: {
    DEG2RAD: number;
    RAD2DEG: number;
    ceilPowerOfTwo(value): number;
    clamp(value, min, max): number;
    compare(num1, num2, tol?): 0 | 1 | -1;
    damp(x, y, lambda, dt): number;
    degToRad(degrees): number;
    euclideanModulo(n, m): number;
    floorPowerOfTwo(value): number;
    generateMeshByQuad(quadPositions, widthSegments?, heightSegments?): {
        indices: number[];
        normals: number[];
        uvs: number[];
        vertices: number[];
    };
    generateUUID(): string;
    interpolation(start, end, segments?): Vector3[];
    isBigger(num1, num2, tol?): boolean;
    isBiggerOrEqual(num1, num2, tol?): boolean;
    isEqual(num1, num2, tol?): boolean;
    isInRange(value, min, max, minOpen?, maxOpen?, tol?): boolean;
    isPowerOfTwo(value): boolean;
    isSmaller(num1, num2, tol?): boolean;
    isSmallerOrEqual(num1, num2, tol?): boolean;
    isZero(num, tol?): boolean;
    lerp(x, y, t): number;
    mapLinear(x, a1, a2, b1, b2): number;
    pingpong(x, length?): number;
    radToDeg(radians): number;
    randFloat(low, high): number;
    randFloatSpread(range): number;
    randInt(low, high): number;
    seededRandom(s): number;
    setQuaternionFromProperEuler(q, a, b, c, order): void;
    smootherstep(x, min, max): number;
    smoothstep(x, min, max): number;
} = ...

Type declaration

  • DEG2RAD: number
  • RAD2DEG: number
  • ceilPowerOfTwo:function
  • clamp:function
  • compare:function
    • Compare two numbers: If num1 is fuzzy equal to num2, return 0. If num1 is fuzzy bigger than num2, return 1. If num1 is fuzzy smaller than num2, return -1. If num1 or num2 is a NaN, throw exception.

      Parameters

      • num1: number
      • num2: number
      • Optional tol: number

      Returns 0 | 1 | -1

  • damp:function
  • degToRad:function
  • euclideanModulo:function
  • floorPowerOfTwo:function
  • generateMeshByQuad:function
    • 根据四方点生成网格

      Parameters

      • quadPositions: Vector3[]

        四方点,左上角为起点,按照顺时针顺序

      • widthSegments: number = 10

        宽度分割段数

      • heightSegments: number = 10

        高度分割段数

      Returns {
          indices: number[];
          normals: number[];
          uvs: number[];
          vertices: number[];
      }

      • indices: number[]
      • normals: number[]
      • uvs: number[]
      • vertices: number[]
  • generateUUID:function
  • interpolation:function
  • isBigger:function
    • Check whether num1 is bigger than num2 with specified tolerance. Global (default) tolerance will be used if tol is not provided.

      Parameters

      • num1: number
      • num2: number
      • Optional tol: number

      Returns boolean

  • isBiggerOrEqual:function
    • Check whether num1 is bigger than or equal to num2 with specified tolerance. Global (default) tolerance will be used if tol is not provided.

      Parameters

      • num1: number
      • num2: number
      • Optional tol: number

      Returns boolean

  • isEqual:function
  • isInRange:function
    • Check whether a number is in a range with specified tolerance. Global (default) tolerance will be used if tol is not provided.

      Parameters

      • value: number

        the value to be checked.

      • min: number

        the range's lower limit.

      • max: number

        the range's upper limit.

      • Optional minOpen: boolean

        whether the range's lower limit is open, default is false.

      • Optional maxOpen: boolean

        whether the range's upper limit is open, default is false.

      • Optional tol: number

      Returns boolean

  • isPowerOfTwo:function
  • isSmaller:function
    • Check wether num1 is smaller than num2 with specified tolerance. Global (default) tolerance will be used if tol is not provided.

      Parameters

      • num1: number
      • num2: number
      • Optional tol: number

      Returns boolean

  • isSmallerOrEqual:function
    • Check whether num1 is smaller than or equal to num2 with specified tolerance. Global (default) tolerance will be used if tol is not provided.

      Parameters

      • num1: number
      • num2: number
      • Optional tol: number

      Returns boolean

  • isZero:function
  • lerp:function
  • mapLinear:function
  • pingpong:function
  • radToDeg:function
  • randFloat:function
  • randFloatSpread:function
  • randInt:function
  • seededRandom:function
  • setQuaternionFromProperEuler:function
  • smootherstep:function
  • smoothstep:function

Generated using TypeDoc