fix
This commit is contained in:
@@ -933,6 +933,23 @@ export function calculateCenterPoint(W, H, currentX, currentY, currentAngleDeg)
|
||||
const Cy = currentY + (W / 2) * sinCurrent + (H / 2) * cosCurrent;
|
||||
return { x: Cx, y: Cy };
|
||||
}
|
||||
/**
|
||||
* 根据中心点坐标计算左上角坐标
|
||||
* @param {number} W - 宽度
|
||||
* @param {number} H - 高度
|
||||
* @param {number} centerX - 中心点x坐标
|
||||
* @param {number} centerY - 中心点y坐标
|
||||
* @param {number} currentAngleDeg - 当前角度(度)
|
||||
* @returns {Object} 左上角坐标 {x, y}
|
||||
*/
|
||||
export function calculateTopLeftPoint(W, H, centerX, centerY, currentAngleDeg) {
|
||||
const currentAngle = (currentAngleDeg * Math.PI) / 180;
|
||||
const cosCurrent = Math.cos(currentAngle);
|
||||
const sinCurrent = Math.sin(currentAngle);
|
||||
const Cx = centerX + (W / 2) * cosCurrent - (H / 2) * sinCurrent;
|
||||
const Cy = centerY + (W / 2) * sinCurrent + (H / 2) * cosCurrent;
|
||||
return { x: Cx, y: Cy };
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user