package bsp type Stats struct { Nodes int Leaves int MaxDepth int TotalSegs int // Summe Segmente in Leaves (nach Splits) } func Measure(n *Node) Stats { var st Stats var rec func(*Node, int) rec = func(x *Node, d int) { if x == nil { return } if d > st.MaxDepth { st.MaxDepth = d } if x.Leaf != nil { st.Leaves++ st.TotalSegs += len(x.Leaf.Segs) return } st.Nodes++ rec(x.Left, d+1) rec(x.Right, d+1) } rec(n, 0) return st }