import { usePileCapStore } from '../../store/pileCapStore'; export const GeometryDiagram = () => { const geometry = usePileCapStore(state => state.geometry); // Dimensions const width = 300; const height = 300; const padding = 40; // Scale factors const scaleX = (width - 2 * padding) / geometry.length; const scaleZ = (height - 2 * padding) / geometry.width; const scale = Math.min(scaleX, scaleZ); // Center offsets const offsetX = (width - geometry.length * scale) / 2; const offsetZ = (height - geometry.width * scale) / 2; // Helper to transform coordinates const toPx = (x: number, z: number) => ({ x: offsetX + x * scale, y: offsetZ + z * scale }); // Generate pile positions const piles = []; const startX = (geometry.length - (geometry.pileColumns - 1) * geometry.pileSpacingX) / 2; const startZ = (geometry.width - (geometry.pileRows - 1) * geometry.pileSpacingY) / 2; for (let i = 0; i < geometry.pileColumns; i++) { for (let j = 0; j < geometry.pileRows; j++) { piles.push({ x: startX + i * geometry.pileSpacingX, z: startZ + j * geometry.pileSpacingY }); } } // Column dimensions in ft const colLenFt = geometry.columnLength / 12; const colWidthFt = geometry.columnWidth / 12; const colX = (geometry.length - colLenFt) / 2 + geometry.columnOffsetX; const colZ = (geometry.width - colWidthFt) / 2 + geometry.columnOffsetZ; return (