Flatten volumetric mesh into "flat" mesh

Hi,

Is there a way to programatically divide a mesh into elements, that are more or less parallel? I tried to search for normal vectors with asumption, that when an angle between them is within a given tolerance, than faces create one mesh, and faces outside of this tollerance are not taken under consideration. But how can I check which face is conencted with which normal vector? I tihnk I am missing something. In other words, I try to get rid of the thickness of the volumetric element.
Or is there a better way to do it?

I’d like to programatically achieve the same result as “explode” does on attached model.

Mesh.ExplodeAtUnweldedEdges() does what you’re looking for with the attached model. This works well for the attached model because its vertices are already unwelded at the desired seams. If they aren’t yet, then you’ll need to use the Mesh.Unweld function, which asks you to supply an angle tolerance for unwelding your mesh vertices (vertices that fall on edges within this tolerance will be split into different vertices between adjacent faces).

Yup it works good on this model, but it is not what I am looking for.

It’s hard to help without a good example mesh.

But if you’re just looking to evaluate faces based on their normals and extract those within a certain tolerance of another angle, you can easily access the mesh’s FaceNormals:

``````Mesh M = yourInputMesh;
Vector V = yourTestVector;

// you may need to first compute face normals
M.FaceNormals.ComputeFaceNormals();

Mesh splitMesh = new Mesh();

// first add all of the vertices from the original mesh
foreach (Point3f vertex in M.Vertices)
{
}

// say a 1 degree tolerance
double toleranceAngle = (1.0 / 180.0) * Math.PI;

// test the face normals against your test vector and add the corresponding face to your split mesh
for (int i = 0; i < M.FaceNormals.Count; i++)
{
if (Vector3d.VectorAngle(M.FaceNormals[i], V) < toleranceAngle)
{
}
}

// Remove any vertices that aren't used by the faces you've extracted
splitMesh.Vertices.CullUnused();``````

Thanks Dave for your effort, however this will be a bit more complicated. It is easy when you have one vector, but what I need to do is to test each face normal Vector against adjacent faces normal vectors, and check angle between them. But I’m working on such algorithm.

Have you tried Unweld yet? That is precisely what it does:

``````Mesh M = myInputMesh;
double angle = myFaceToFaceTolerance;

double tol = (angle / 180.0) * Math.PI;

M.Unweld(tol, true);
return M.ExplodeAtUnweldedEdges();``````

OK, this is worth testing definitelly. Let me give it a shot.

Yes, this is what I was looking for. Thank you for saving me time.