mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
13 lines
430 B
TypeScript
13 lines
430 B
TypeScript
import { cartesian2Polar, polar, radians } from "./angle";
|
|
import { pointFrom } from "./point";
|
|
|
|
describe("cartesian to polar coordinate conversion", () => {
|
|
it("converts values properly", () => {
|
|
expect(cartesian2Polar(pointFrom(12, 5))).toEqual(
|
|
polar(13, radians(Math.atan(5 / 12))),
|
|
);
|
|
expect(cartesian2Polar(pointFrom(5, 5))).toEqual(
|
|
polar(5 * Math.sqrt(2), radians(Math.PI / 4)),
|
|
);
|
|
});
|
|
});
|