Get unique planes from mesh object

In the file below, there is a mess-h… Composed of 26 faces, some overlapping, some inverted normals. In a few seconds I can draw four 3 and 4 point surfaces to create the clean planar surfaces that this mesh represents. However, I need to automate this for many objects (and this is an extremely simple case).

MeshPlaneDetection.3dm (3.0 MB)

My idea was to get the normal or the plane for each mesh face and somehow compare all to come up with the 4 unique planes that they lie in, once I have that it’s not too hard to extract the faces that lie in each plane and get their combined silhouette, which can then be automatically cleaned (curve boolean) and surfaced.

I guess the best way is to work with the mesh face normals; what I don’t know is how to take a collection of vectors that contains sets of similar but not identical normal vectors (floating point and other fuzz) and come up with one unique vector for each set which can then be used to construct the planes (origin in this case doesn’t matter).

I see there is an EpsilonEquals method to compare two vectors, I guess I could start with that, but I was wondering if anyone has a better/simpler idea. TIA.

I tried convex hull, but even then there seem to be parts sticking through. The mesh is quite far from the origin also:


edit: if somehow you can select the extreme points, it would produce a clean mesh:

What about making points from the unitized vectors and then use this ?

Sphere.FitSphereToPoints Method (

Using the sphere’s center as the resulting vector, possibly unitizing it.

Hi Emilio,

I ended up implementing my own brute force pseudo-set method, looping through the list of all the normal vectors and comparing each one in the list to all of the existing ‘unique’ ones via Vector3D.IsParallelTo(Vector3D,Tolerance) and if no parallel match is found, add that vector to the set of unique ones. Works OK, what I found is that the mesh faces in the example above actually are not all that coplanar, I have to set the angle tolerance to about 0.5° to get the 4 unique planes. Bad meshes and far from the origin (georeferenced) is not a good combination.

I’m thinking that maybe instead of using the first found unique vector in the list and just ignoring the others that match, I should make collections of all the ‘similar’ vectors and then average the collection afterwards, will see if I need that improved accuracy.

1 Like

How about taking the vector for the largest face in a set as the norm for that set?

Although any adjustment of the normals may bring problems matching edges to adjacent superfaces.

Are all the objects of the same four-faced, open bottomed pattern?

Yes, considering that, just means that I need to track the mesh face area along with its index, etc. More bookkeeping.

Yes - but I am only using this to check if a mesh face is “close” to being in a certain plane - the original mesh faces that are close will be used to get the silhouette. Yes, the potential for everything pulling apart here is large.


Hi Mitch,

Yes, even worse if they are single-precision meshes …
I would be concerned about not being able to join togegher the rebuilt mesh faces. :confused:

Maybe … assuming that any vertex only lies on three faces, using the intersection of the three planes as the vertex location … but sounds complicated.


For the moment I have this:

So I did manage the extraction of the meshes for each plane, and was able to create closed loops via Silhouette - the trapezoidal faces are slightly out of planar strictly speaking, but seem to make planar brep faces anyway that are close enough to join without any internal naked edges. I was left with two open curves from the Silhouette operation (red).

So this simple example works more or less, however, I am not sure it will work on anything else, the problem area is making sure the outer borders are closed clean curves… The trapezoidal faces may not always be planar enough to make planar faces. I will continue playing with it a bit, this is more of an intellectual exercise to try and keep my few remaining brain cells from falling asleep permanently. :stuck_out_tongue_winking_eye:


Eeeeh … yeah, same here ! :wink: :smile:

Ahh, unfortunately it seems to fail on other slightly less simple examples, so it’s back to the drawing board. :confounded: Think I’ll shelve it for awhile.

Hey Mitch -
I don’t know if this gets you any further…

It’s based on @jeremy5’s suggestion to use the normal of the largest face and, in this definition, is hardcoded to the 4 largest faces.

Which, in all likelihood, this one also will :see_no_evil:
… and it doesn’t even join all 4 surfaces up into a single nice polysurface… (20.2 KB)