Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

helpers.math.d.ts 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import type { Point } from '../types/geometric.js';
  2. /**
  3. * @alias Chart.helpers.math
  4. * @namespace
  5. */
  6. export declare const PI: number;
  7. export declare const TAU: number;
  8. export declare const PITAU: number;
  9. export declare const INFINITY: number;
  10. export declare const RAD_PER_DEG: number;
  11. export declare const HALF_PI: number;
  12. export declare const QUARTER_PI: number;
  13. export declare const TWO_THIRDS_PI: number;
  14. export declare const log10: (x: number) => number;
  15. export declare const sign: (x: number) => number;
  16. export declare function almostEquals(x: number, y: number, epsilon: number): boolean;
  17. /**
  18. * Implementation of the nice number algorithm used in determining where axis labels will go
  19. */
  20. export declare function niceNum(range: number): number;
  21. /**
  22. * Returns an array of factors sorted from 1 to sqrt(value)
  23. * @private
  24. */
  25. export declare function _factorize(value: number): number[];
  26. export declare function isNumber(n: unknown): n is number;
  27. export declare function almostWhole(x: number, epsilon: number): boolean;
  28. /**
  29. * @private
  30. */
  31. export declare function _setMinAndMaxByKey(array: Record<string, number>[], target: {
  32. min: number;
  33. max: number;
  34. }, property: string): void;
  35. export declare function toRadians(degrees: number): number;
  36. export declare function toDegrees(radians: number): number;
  37. /**
  38. * Returns the number of decimal places
  39. * i.e. the number of digits after the decimal point, of the value of this Number.
  40. * @param x - A number.
  41. * @returns The number of decimal places.
  42. * @private
  43. */
  44. export declare function _decimalPlaces(x: number): number;
  45. export declare function getAngleFromPoint(centrePoint: Point, anglePoint: Point): {
  46. angle: number;
  47. distance: number;
  48. };
  49. export declare function distanceBetweenPoints(pt1: Point, pt2: Point): number;
  50. /**
  51. * Shortest distance between angles, in either direction.
  52. * @private
  53. */
  54. export declare function _angleDiff(a: number, b: number): number;
  55. /**
  56. * Normalize angle to be between 0 and 2*PI
  57. * @private
  58. */
  59. export declare function _normalizeAngle(a: number): number;
  60. /**
  61. * @private
  62. */
  63. export declare function _angleBetween(angle: number, start: number, end: number, sameAngleIsFullCircle?: boolean): boolean;
  64. /**
  65. * Limit `value` between `min` and `max`
  66. * @param value
  67. * @param min
  68. * @param max
  69. * @private
  70. */
  71. export declare function _limitValue(value: number, min: number, max: number): number;
  72. /**
  73. * @param {number} value
  74. * @private
  75. */
  76. export declare function _int16Range(value: number): number;
  77. /**
  78. * @param value
  79. * @param start
  80. * @param end
  81. * @param [epsilon]
  82. * @private
  83. */
  84. export declare function _isBetween(value: number, start: number, end: number, epsilon?: number): boolean;