public void Equalise() { int maxDepth = FindMaxDepth(); int aDepth = a.FindMaxDepth(); int bDepth = b.FindMaxDepth(); int cDepth = c.FindMaxDepth(); int dDepth = d.FindMaxDepth(); if (aDepth < maxDepth - 1) { for (int i = 0; i < maxDepth - aDepth; i++) { a.SubdivideQuad(); a.a.SubdivideQuad(); a.b.SubdivideQuad(); a.c.SubdivideQuad(); a.d.SubdivideQuad(); } } if (bDepth < maxDepth - 1) { for (int i = 0; i < maxDepth - bDepth; i++) { b.SubdivideQuad(); b.a.SubdivideQuad(); b.b.SubdivideQuad(); b.c.SubdivideQuad(); b.d.SubdivideQuad(); } } if (cDepth < maxDepth - 1) { for (int i = 0; i < maxDepth - cDepth; i++) { c.SubdivideQuad(); c.a.SubdivideQuad(); c.b.SubdivideQuad(); c.c.SubdivideQuad(); c.d.SubdivideQuad(); } } if (dDepth < maxDepth - 1) { for (int i = 0; i < maxDepth - dDepth; i++) { d.SubdivideQuad(); d.a.SubdivideQuad(); d.b.SubdivideQuad(); d.c.SubdivideQuad(); d.d.SubdivideQuad(); } } }