Your issue Numero Uno is that you don’t use the V1A (the thing that deals with BrepFaces instead of Surfaces). This means that you are into a big rabbit hole with many entries but not a single exit (like tuning a Harley Davidson). Since these days the majority of facade panels are not Surfaces (unlike stuff the likes of Bilbao) … well … blah, blah, What if you receive a part that looks like a triangle BUT may be a trimmed thingy OR a Surface with a singularity OR a piece from outer space? What if you buy a V4R and set the engine mode to R? (and disable TC).
Other than that you’ll also need a filtering policy (like in V1A). Other than that you’ll need a proper recursion. Recursion is explained in depth in the Prophetic Trilogy:
With regard some “diagnostics” related with a BrepFace that is not a Surface:
- You can report the areas (Face, Underlying Surface) and if they differ beyond an user defined value … do something.
- You can count the pieces that make the edges, say in a thing that looks like an OK quad Surface (but is a BrepFace). If an edge has 2 pieces and the corresponding one 66 … blah, blah.
- You can play with Locus points on the edges (that’s a bit tricky).
- etc etc
BTW: With regard your recursion (up to tol). Imagine dividing a thing, picking a search policy (say min OscR in U or V as shown below), getting the points where Gaussian > tol (you can control that value obviously … but avoid getting lost in the translation) … and defining an Interval of interest (say the upper 30% as shown). Depending on the U/V values (the resolution, that is) we get either this:
Or that (or any other):
Notice that the percentage is the same (obviously) and the search Interval bounds are almost the same (in real-life are the same)… but you get a more refined result. Plus the u/v enumeration is grid like (meaning easier LINQ queries for the final part of the story)
Given all that the 1M question is: why bother with recursion?
And why bother with flat spots? (Gaussian < tol). But we should bother with the GC sign (meaning green TextDots for + , red for - … that does the VIB as well).
BTW: Your recursion is not correct: can you see from that pic why? Well … because you test for planarity 2 corners (so the blue and light blue ones stay intact) instead of doing the right thing for testing a quad planarity: min diagonal distance < planarityTol … or … wait … is better to use the R Method for that matter, case: bulges with planar corner pts etc etc (I’ll fix that by introducing the classic History Tree as well).
Prior the history (and some other freaky things) here’s your recursion (kinda a Pani V2: Less is waaaaaaaaaay more):
And here’s the correct results:
Get the thing (prior the History tree):
Surface_RecursiveDivide_upToPlanarityTol_V1A.gh (76.1 KB)
BTW: What are you going to do with a Surface with a singularity? What are you going to do if your father in law offers you a KTM RC8R? Or the widow maker? (ZX10R) Or the other widow maker? (Honda CR500).