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.
angleRad
origin
import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'// Rotates line by 0.1 radians around point 10,10const r = Lines.rotate(line, 0.1, {x:10,y:10});// Rotate line by 5 degrees around its centerconst r = Lines.rotate(line, degreeToRadian(5));// Rotate line by 5 degres around its end pointconst r = Lines.rotate(line, degreeToRadian(5), line.b);// Rotate by 90 degrees at the 80% positionconst r = Lines.rotated = rotate(line, Math.PI / 2, 0.8); Copy
import { Lines } from 'https://unpkg.com/ixfx/dist/geometry.js'// Rotates line by 0.1 radians around point 10,10const r = Lines.rotate(line, 0.1, {x:10,y:10});// Rotate line by 5 degrees around its centerconst r = Lines.rotate(line, degreeToRadian(5));// Rotate line by 5 degres around its end pointconst r = Lines.rotate(line, degreeToRadian(5), line.b);// Rotate by 90 degrees at the 80% positionconst r = Lines.rotated = rotate(line, Math.PI / 2, 0.8);
Line to rotate
Optional
Angle in radians to rotate by
Point to rotate around. If undefined, middle of line will be used
Returns a line that is rotated by
angleRad
. By default it rotates around its center, but an arbitraryorigin
point can be provided. Iforigin
is a number, it's presumed to be a 0..1 percentage of the line.