figureone
    Preparing search index...

    Function clipAngle

    • Clip and angle between 0 and 2π ('0to360') or -π to π ('-180to180'). null will return the angle between -2π to 2π.

      Parameters

      • angleToClip: number
      • clipTo: "0to360" | "-180to180" | "-360to360" | "-360to0" | null

      Returns number

      const clipAngle = Fig.clipAngle

      const a1 = clipAngle(Math.PI / 2 * 5, '0to360');
      console.log(a1);
      // 1.5707963267948966

      const a2 = clipAngle(Math.PI / 4 * 5, '-180to180');
      console.log(a2);
      // -2.356194490192345

      const a3 = clipAngle(-Math.PI / 4 * 10, null);
      console.log(a3);
      // -1.5707963267948966