You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
success/packages/math/angle.test.ts

14 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)),
);
});
});