board rotation

This commit is contained in:
chk
2026-06-10 17:57:05 +02:00
parent 5d13b7685c
commit 9105dc5eac
5 changed files with 407 additions and 5 deletions

View File

@@ -260,13 +260,14 @@ function buildScene(data) {
if (boardMarkers.length > 0) {
let minRx = Infinity, maxRx = -Infinity;
let minRy = Infinity, maxRy = -Infinity;
let markerRz = -27.3;
let markerRz = Infinity; // Minimum aller z tiefster Marker (z=up → kleinstes = am tiefsten)
for (const m of boardMarkers) {
const [rx, ry, rz] = m.position;
if (rx < minRx) minRx = rx; if (rx > maxRx) maxRx = rx;
if (ry < minRy) minRy = ry; if (ry > maxRy) maxRy = ry;
markerRz = rz;
if (rz < markerRz) markerRz = rz;
}
if (!isFinite(markerRz)) markerRz = -27.3;
const pad = 40; // mm Rand
const planeW = (maxRx - minRx + 2 * pad) * S;
const planeH = (maxRy - minRy + 2 * pad) * S;
@@ -290,13 +291,20 @@ function buildScene(data) {
const pos = r2vArr(m.position);
const detected = detectedIds.has(m.id);
if (detected) nDetected++;
const color = detected ? 0x22c55e : 0xef4444;
const isA0 = m.set === 'A0';
// A0: grün (erkannt) / rot (nicht erkannt) andere Sets: blau / dunkelblau
const color = isA0
? (detected ? 0x22c55e : 0xef4444)
: (detected ? 0x3b82f6 : 0x1e40af);
const sq = makeMarkerSquare(pos, visSize, color);
sq.position.y += 0.0005;
gMarkers.add(sq);
const border = makeEdgeBorder(pos, visSize, detected ? 0x4ade80 : 0xfca5a5);
const borderCol = isA0
? (detected ? 0x4ade80 : 0xfca5a5)
: (detected ? 0x60a5fa : 0x3b82f6);
const border = makeEdgeBorder(pos, visSize, borderCol);
border.position.y += 0.001;
gMarkers.add(border);
}