modeling/src/maths/line3/create.js

  1. const vec3 = require('../vec3')
  2. /**
  3. * Represents a unbounded line in 3D space, positioned at a point of origin.
  4. * A line is parametrized by a point of origin and a directional vector.
  5. *
  6. * The array contents are two 3D vectors; origin [0,0,0] and directional vector [0,0,1].
  7. * @see https://en.wikipedia.org/wiki/Hesse_normal_form
  8. * @typedef {Array} line3
  9. */
  10. /**
  11. * Create a line, positioned at 0,0,0 and lying on the X axis.
  12. *
  13. * @returns {line3} a new unbounded line
  14. * @alias module:modeling/maths/line3.create
  15. */
  16. const create = () => [
  17. vec3.fromValues(0, 0, 0), // origin
  18. vec3.fromValues(0, 0, 1) // direction
  19. ]
  20. module.exports = create