math.scalar.functions.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Extract int value
  3. * @param value number value
  4. * @returns int value
  5. */
  6. export declare function ExtractAsInt(value: number): number;
  7. /**
  8. * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
  9. * @param a number
  10. * @param b number
  11. * @param epsilon (default = 1.401298E-45)
  12. * @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
  13. */
  14. export declare function WithinEpsilon(a: number, b: number, epsilon?: number): boolean;
  15. /**
  16. * Returns a random float number between and min and max values
  17. * @param min min value of random
  18. * @param max max value of random
  19. * @returns random value
  20. */
  21. export declare function RandomRange(min: number, max: number): number;
  22. /**
  23. * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
  24. * @param start start value
  25. * @param end target value
  26. * @param amount amount to lerp between
  27. * @returns the lerped value
  28. */
  29. export declare function Lerp(start: number, end: number, amount: number): number;
  30. /**
  31. * Returns the value itself if it's between min and max.
  32. * Returns min if the value is lower than min.
  33. * Returns max if the value is greater than max.
  34. * @param value the value to clmap
  35. * @param min the min value to clamp to (default: 0)
  36. * @param max the max value to clamp to (default: 1)
  37. * @returns the clamped value
  38. */
  39. export declare function Clamp(value: number, min?: number, max?: number): number;
  40. /**
  41. * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.
  42. * @param angle The angle to normalize in radian.
  43. * @returns The converted angle.
  44. */
  45. export declare function NormalizeRadians(angle: number): number;
  46. /**
  47. * Returns a string : the upper case translation of the number i to hexadecimal.
  48. * @param i number
  49. * @returns the upper case translation of the number i to hexadecimal.
  50. */
  51. export declare function ToHex(i: number): string;