modeling/src/maths/line2/create.js

  1. /**
  2. * Represents a unbounded line in 2D space, positioned at a point of origin.
  3. * A line is parametrized by a normal vector (perpendicular to the line, rotated 90 degrees counter clockwise) and
  4. * distance from the origin.
  5. *
  6. * Equation: A Point (P) is on Line (L) if dot(L.normal, P) == L.distance
  7. *
  8. * The contents of the array are a normal [0,1] and a distance [2].
  9. * @typedef {Array} line2
  10. */
  11. /**
  12. * Create a line, positioned at 0,0, and running along the X axis.
  13. *
  14. * @returns {line2} a new unbounded line
  15. * @alias module:modeling/maths/line2.create
  16. */
  17. const create = () => [0, 1, 0] // normal and distance
  18. module.exports = create