Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5800

Get unique planes from mesh object

$
0
0

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.

3 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 5800