feat: angle range

This commit is contained in:
cha0s 2021-02-03 13:42:38 -06:00
parent 7102f225e6
commit 477fb196aa

View File

@ -54,6 +54,10 @@ export const frac = (number) => number % 1;
export const angleFromRad = (r) => (
(360 + ((2 * Math.PI - (r + HALF_PI)) % (Math.PI * 2)) / -PI_180) % 360
);
export const angleRange = (angle, delta) => ({
min: 360 + (angle - delta),
max: 360 + (angle + delta),
});
export const mul = (l, r) => l * r;
export const normalizeAngleRange = (min, max) => {
/* eslint-disable no-param-reassign */
@ -108,6 +112,20 @@ export function describe() {
},
],
},
angleRange: {
label: 'Angle range',
type: 'object',
args: [
{
label: 'Angle',
type: 'number',
},
{
label: 'Delta',
type: 'number',
},
],
},
floor: {
label: 'Floor',
type: 'number',