Fix EPC end box collision and bounds to match 90° rotation

Rotate the direction vector -90° for the right box in collision
detection and bounds calculation to match the perpendicular
rendering orientation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
igurielidze 2026-03-30 15:38:37 +04:00
parent a4884b4e9b
commit e4c67b165b
2 changed files with 4 additions and 3 deletions

View File

@ -401,9 +401,10 @@ function getEpcCollisionQuads(
// Right box quad // Right box quad
const last = waypoints[waypoints.length - 1]; const last = waypoints[waypoints.length - 1];
const prev = waypoints[waypoints.length - 2]; const prev = waypoints[waypoints.length - 2];
const rbDx = last.x - prev.x, rbDy = last.y - prev.y;
const rbQ = boxQuad( const rbQ = boxQuad(
ox + last.x, oy + last.y, ox + last.x, oy + last.y,
last.x - prev.x, last.y - prev.y, rbDy, -rbDx, // rotated -90° to match perpendicular end box
EPC_CONFIG.rightBox.w, EPC_CONFIG.rightBox.h, EPC_CONFIG.rightBox.w, EPC_CONFIG.rightBox.h,
'right' 'right'
); );

View File

@ -360,8 +360,8 @@ function recalcEpcBounds(sym: typeof layout.symbols[0]) {
// Right box corners (oriented along last segment) // Right box corners (oriented along last segment)
const last = wps[wps.length - 1]; const last = wps[wps.length - 1];
const prev = wps[wps.length - 2]; const prev = wps[wps.length - 2];
const rbDir = { x: last.x - prev.x, y: last.y - prev.y }; const rbDx = last.x - prev.x, rbDy = last.y - prev.y;
const rbCorners = orientedBoxCorners(last.x, last.y, rbDir.x, rbDir.y, EPC_CONFIG.rightBox.w, EPC_CONFIG.rightBox.h, 'right'); const rbCorners = orientedBoxCorners(last.x, last.y, rbDy, -rbDx, EPC_CONFIG.rightBox.w, EPC_CONFIG.rightBox.h, 'right');
for (const [bx, by] of rbCorners) { for (const [bx, by] of rbCorners) {
minX = Math.min(minX, bx); minY = Math.min(minY, by); minX = Math.min(minX, bx); minY = Math.min(minY, by);
maxX = Math.max(maxX, bx); maxY = Math.max(maxY, by); maxX = Math.max(maxX, bx); maxY = Math.max(maxY, by);