(position, origin, angle)
| 67 | }; |
| 68 | |
| 69 | export 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 | |
| 83 | export const isPositionInCorners = (position, corners, pity = [0, 0]) => { |
| 84 | const mappedPosition = getMappedPosition(position, corners); |