Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getPosByDirection(
poses: number[][],
direction: number[],
) {
/*
[-1, -1](pos1) [0, -1](pos1,pos2) [1, -1](pos2)
[-1, 0](pos1, pos3) [1, 0](pos2, pos4)
[-1, 1](pos3) [0, 1](pos3, pos4) [1, 1](pos4)
*/
const nextPoses = getPosesByDirection(poses, direction);
return [
average(...nextPoses.map(pos => pos[0])),
average(...nextPoses.map(pos => pos[1])),
];
}
export function getPosByReverseDirection(
export function getPosByDirection(
poses: number[][],
direction: number[],
) {
/*
[-1, -1](pos1) [0, -1](pos1,pos2) [1, -1](pos2)
[-1, 0](pos1, pos3) [1, 0](pos2, pos4)
[-1, 1](pos3) [0, 1](pos3, pos4) [1, 1](pos4)
*/
const nextPoses = getPosesByDirection(poses, direction);
return [
average(...nextPoses.map(pos => pos[0])),
average(...nextPoses.map(pos => pos[1])),
];
}
export function getPosByReverseDirection(