MCPcopy Create free account
hub / github.com/TodePond/ScreenPond / getRotatedPosition

Function getRotatedPosition

source/position.js:69–81  ·  view source on GitHub ↗
(position, origin, angle)

Source from the content-addressed store, hash-verified

67};
68
69export const getRotatedPosition = (position, origin, angle) => {
70 const [px, py] = position;
71 const [ox, oy] = origin;
72
73 const cos = Math.cos(angle);
74 const sin = Math.sin(angle);
75 const dy = py - oy;
76 const dx = px - ox;
77
78 const x = dx * cos + dy * sin + ox;
79 const y = dy * cos - dx * sin + oy;
80 return [x, y];
81};
82
83export const isPositionInCorners = (position, corners, pity = [0, 0]) => {
84 const mappedPosition = getMappedPosition(position, corners);

Callers 1

getRotatedCornersFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected