implemented png export so that we get a overlay of the splitt lines and also directly export a node tree visualization of the node tree with graphviz.

This commit is contained in:
Doc
2025-09-28 12:50:16 +02:00
parent 72fa5e900c
commit c908193986
3 changed files with 203 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import (
"bytes"
"fmt"
"os"
"os/exec"
)
// EmitDOT serialisiert den BSP-Baum mit Wurzel root und schreibt ihn als DOT-Datei nach path.
@@ -39,3 +40,12 @@ func EmitDOT(root *bsp.Node, path string) error {
buf.WriteString("}\n")
return os.WriteFile(path, buf.Bytes(), 0644)
}
func RunGraphviz(dotFile, pngFile string) error {
cmd := exec.Command("dot", "-Tpng", dotFile, "-o", pngFile)
out, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("graphviz failed: %v\n%s", err, string(out))
}
return nil
}