diff --git a/src/utils/tool.js b/src/utils/tool.js index d2c0b7e..8c2e603 100644 --- a/src/utils/tool.js +++ b/src/utils/tool.js @@ -36,7 +36,10 @@ function calcRectangleFromPoints(points) { const height = trapezoid ? (left + right) / 2 : right; const bottomAngleRad = Math.atan2(p1.y - p4.y, p1.x - p4.x); + const leftAngleRad = Math.atan2(p1.x - p2.x, p1.y - p2.y); const angleDeg = bottomAngleRad * 180 / Math.PI; + console.log(leftAngleRad * 180 / Math.PI; +) return { width: Number(width.toFixed(2)), height: Number(height.toFixed(2)), angle: Number(angleDeg.toFixed(6)) }; @@ -62,7 +65,6 @@ function getLocalPositionRelativeToP4(point, rectPoints, rectInfo) { const y_local = dx * Math.sin(rad) + dy * Math.cos(rad); const rotate_local = ((point.rotate ?? 0) + rectInfo.angle + 360) % 360; - console.log(rotate_local) return { x: Number(x_local.toFixed(2)), y: Number(y_local.toFixed(2)), rotate: Number(rotate_local.toFixed(2)) };