ixfx
    Preparing search index...

    Function rotate

    • Returns a line that is rotated by angleRad. By default it rotates around its center, but an arbitrary origin point can be provided. If origin is a number, it's presumed to be a 0..1 percentage of the line.

      import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'

      // Rotates line by 0.1 radians around point 10,10
      const r = Lines.rotate(line, 0.1, {x:10,y:10});

      // Rotate line by 5 degrees around its center
      const r = Lines.rotate(line, degreeToRadian(5));

      // Rotate line by 5 degres around its end point
      const r = Lines.rotate(line, degreeToRadian(5), line.b);

      // Rotate by 90 degrees at the 80% position
      const r = Lines.rotated = rotate(line, Math.PI / 2, 0.8);

      Parameters

      • line: Geometry.Line

        Line to rotate

      • OptionalamountRadian: number

        Angle in radians to rotate by

      • Optionalorigin: number | Geometry.Point

        Point to rotate around. If undefined, middle of line will be used

      Returns Geometry.Line