pointRotate
Rotates a point around a given origin.
Basic example
Section titled “Basic example”Rotates a point by an angle in radians around the origin [0, 0] by default. A quarter turn (π/2) moves [100, 0] onto the y axis; the tiny residue on x is ordinary floating-point error.
import {pointRotate} from "@d3plus/math";
pointRotate([100, 0], Math.PI / 2);
Custom origin
Section titled “Custom origin”The third argument sets the center of rotation, so the point swings around [40, 40] instead of the origin. Radial layouts rotate label anchors this way.
import {pointRotate} from "@d3plus/math";
pointRotate([80, 40], Math.PI / 4, [40, 40]);
Parameters
import {pointRotate} from "@d3plus/math";