ixfx
    Preparing search index...

    Function toUnitVector

    • Compute unit vector of an angle. The unit vector is essentially the direction of an angle.

      unitVector(90); // 90 deg
      unitVector(`1.2rad`); // 1.2 in radians

      The coordinate space is -1..1:

         y 1
      |
      |
      -1 --+--- 1 x
      |
      |
      -1

      See fromUnitVector to convert back to an angle

      Parameters

      • angleOrDegrees: string | number | Angle

        Angle specified in degrees, or an angle with units

      Returns { x: number; y: number }