tools.functions.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Function indicating if a number is an exponent of 2
  3. * @param value defines the value to test
  4. * @returns true if the value is an exponent of 2
  5. */
  6. export declare function IsExponentOfTwo(value: number): boolean;
  7. /**
  8. * Interpolates between a and b via alpha
  9. * @param a The lower value (returned when alpha = 0)
  10. * @param b The upper value (returned when alpha = 1)
  11. * @param alpha The interpolation-factor
  12. * @returns The mixed value
  13. */
  14. export declare function Mix(a: number, b: number, alpha: number): number;
  15. /**
  16. * Find the nearest power of two.
  17. * @param x Number to start search from.
  18. * @returns Next nearest power of two.
  19. */
  20. export declare function NearestPOT(x: number): number;
  21. /**
  22. * Find the next highest power of two.
  23. * @param x Number to start search from.
  24. * @returns Next highest power of two.
  25. */
  26. export declare function CeilingPOT(x: number): number;
  27. /**
  28. * Find the next lowest power of two.
  29. * @param x Number to start search from.
  30. * @returns Next lowest power of two.
  31. */
  32. export declare function FloorPOT(x: number): number;
  33. /**
  34. * Get the closest exponent of two
  35. * @param value defines the value to approximate
  36. * @param max defines the maximum value to return
  37. * @param mode defines how to define the closest value
  38. * @returns closest exponent of two of the given value
  39. */
  40. export declare function GetExponentOfTwo(value: number, max: number, mode?: number): number;