This commit is contained in:
33333-33333 2026-07-20 14:36:59 +09:00
commit f6d7412744
94 changed files with 3836 additions and 1226 deletions

View file

@ -565,8 +565,6 @@
return null;
}
const distanceToSegment = (px, py, ax, ay, bx, by) => global.TarinaiGeometry.pointSegmentDistance(px, py, ax, ay, bx, by);
function wirePath(config, wire) {
const a = endpointPosition(config, wire.a);
const b = endpointPosition(config, wire.b);
@ -579,7 +577,7 @@
for (let i = config.wires.length - 1; i >= 0; i -= 1) {
const path = wirePath(config, config.wires[i]);
if (path.length < 2) continue;
const d = distanceToSegment(x, y, path[0].x, path[0].y, path[1].x, path[1].y);
const d = global.TarinaiGeometry.pointSegmentDistance(x, y, path[0].x, path[0].y, path[1].x, path[1].y);
if (d <= bestD) { bestD = d; best = { wire: config.wires[i], index: i, distance: d }; }
}
return best;
@ -608,7 +606,7 @@
}
function pointOnSegment(point, a, b) {
return distanceToSegment(point.x, point.y, a.x, a.y, b.x, b.y) < 0.6
return global.TarinaiGeometry.pointSegmentDistance(point.x, point.y, a.x, a.y, b.x, b.y) < 0.6
&& point.x >= Math.min(a.x, b.x) - 0.6 && point.x <= Math.max(a.x, b.x) + 0.6
&& point.y >= Math.min(a.y, b.y) - 0.6 && point.y <= Math.max(a.y, b.y) + 0.6;
}