UNPKG

891 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.convertAngles = exports.toDegree = exports.toRadian = void 0;
4function toRadian(degree) {
5 return (degree * Math.PI) / 180;
6}
7exports.toRadian = toRadian;
8function toDegree(radian) {
9 return (radian * 180) / Math.PI;
10}
11exports.toDegree = toDegree;
12// convert the angle to the range of 0 to 4*Math.PI
13function convertAngles(startAngle, endAngle) {
14 startAngle = startAngle % (2 * Math.PI);
15 endAngle = endAngle % (2 * Math.PI);
16 if (startAngle < 0) {
17 startAngle = 2 * Math.PI + startAngle;
18 }
19 if (endAngle < 0) {
20 endAngle = 2 * Math.PI + endAngle;
21 }
22 if (startAngle >= endAngle) {
23 endAngle = endAngle + 2 * Math.PI;
24 }
25 return {
26 startAngle,
27 endAngle,
28 };
29}
30exports.convertAngles = convertAngles;
31//# sourceMappingURL=angle.js.map
\No newline at end of file