modeling/src/maths/constants.js

  1. /**
  2. * The resolution of space, currently one hundred nanometers.
  3. * This should be 1 / EPS.
  4. * @alias module:modeling/maths.spatialResolution
  5. * @default
  6. */
  7. const spatialResolution = 1e5
  8. /**
  9. * Epsilon used during determination of near zero distances.
  10. * This should be 1 / spacialResolution.
  11. * @default
  12. * @alias module:modeling/maths.EPS
  13. */
  14. const EPS = 1e-5
  15. /**
  16. * Smaller epsilon used for measuring near zero distances.
  17. * @default
  18. * @alias module:modeling/maths.NEPS
  19. */
  20. const NEPS = 1e-13
  21. // NEPS is derived from a series of tests to determine the optimal precision
  22. // for comparing coplanar polygons, as provided by the sphere primitive at high
  23. // segmentation. NEPS is for 64 bit Number values.
  24. /**
  25. * The TAU property represents the ratio of the circumference of a circle to its radius.
  26. * Approximately 6.28318530717958647692
  27. * @default
  28. * @example
  29. * const { TAU } = require('@jscad/modeling').maths.constants
  30. */
  31. const TAU = Math.PI * 2
  32. module.exports = {
  33. EPS,
  34. NEPS,
  35. TAU,
  36. spatialResolution
  37. }