renderSvg($matrix); echo "Generated SVG:\n"; echo " Length: " . strlen($svg) . " bytes\n"; // Check SVG structure if (preg_match('/width="(\d+)" height="(\d+)"/', $svg, $sizeMatches)) { echo " Canvas size: {$sizeMatches[1]}x{$sizeMatches[2]}\n"; } // Check module size if (preg_match('/width="(\d+\.?\d*)" height="(\d+\.?\d*)" fill="black"/', $svg, $moduleMatches)) { echo " Module size: {$moduleMatches[1]}x{$moduleMatches[2]}\n"; } // Count rectangles $rectCount = substr_count($svg, ' (float)$b[1]; } return $y1 <=> $y2; }); echo "First 7 rectangles (first row of finder pattern):\n"; for ($i = 0; $i < min(7, count($finderRects)); $i++) { $m = $finderRects[$i]; echo " x={$m[1]}, y={$m[2]}\n"; } // Check if module size is consistent $moduleSizes = []; foreach ($matches as $m) { $w = (float)$m[3]; $h = (float)$m[4]; $key = "{$w}x{$h}"; $moduleSizes[$key] = ($moduleSizes[$key] ?? 0) + 1; } echo "\nModule size distribution:\n"; foreach ($moduleSizes as $size => $count) { echo " {$size}: {$count} rectangles\n"; } if (count($moduleSizes) === 1) { echo "✅ All modules have same size\n"; } else { echo "❌ Modules have different sizes!\n"; }