rapid-sdk
    Preparing search index...

    Function vecProject

    • Find closest orthogonal projection of point onto points array

      Parameters

      • a: Vec2

        source point

      • points: Vec2[]

        target points

      Returns Edge | null

      Edge object containing info about the projected point, or null if points is a degenerate path (0- or 1- point).

      c
      |
      a --*--- b

      * = [2, 0]

      const a = [0, 0];
      const b = [5, 0];
      const c = [2, 1];
      vecProject(c, [a, b]); // returns Edge { index: 1, distance: 1, point: [2, 0] }