Commit c680c6c2 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

ENH: Add option to enforce consistency of normals in extractSurfaceMesh

Add option to enforce consistency of winding of resulting surface mesh in the extractSurfaceMesh function
parent d04c7e4d
Pipeline #65470 passed with stage
......@@ -108,7 +108,7 @@ TetrahedralMesh::computeAttachedSurfaceMesh()
}
bool
TetrahedralMesh::extractSurfaceMesh(std::shared_ptr<SurfaceMesh> surfaceMesh)
TetrahedralMesh::extractSurfaceMesh(std::shared_ptr<SurfaceMesh> surfaceMesh, const bool enforceWindingConsistency /* = false*/)
{
if (!surfaceMesh)
{
......@@ -219,6 +219,11 @@ TetrahedralMesh::extractSurfaceMesh(std::shared_ptr<SurfaceMesh> surfaceMesh)
// Create and attach surface mesh
surfaceMesh->initialize(vertPositions, surfaceTri);
if (enforceWindingConsistency)
{
surfaceMesh->correctWindingOrder();
}
return true;
}
......
......@@ -86,7 +86,8 @@ public:
/// (a) Extracts the confirming triangular mesh from the tetrahedral mesh
/// (b) Checks and flips the triangle connectivity order if it is not consistent
/// (c) Renumbers the vertices
bool extractSurfaceMesh(std::shared_ptr<SurfaceMesh> surfaceMesh);
/// (d) optionally enforces the consistency of winding of resulting surface triangles
bool extractSurfaceMesh(std::shared_ptr<SurfaceMesh> surfaceMesh, const bool enforceWindingConsistency = false);
///
/// \brief compute the barycentric weights of a given point in 3D space for a given the tetrahedra
......
......@@ -1331,7 +1331,11 @@ void testPbdVolume()
LOG(WARNING) << "Dynamic pointer cast from imstk::Mesh to imstk::TetrahedralMesh failed!";
return;
}
volTetMesh->extractSurfaceMesh(surfMesh);
volTetMesh->extractSurfaceMesh(surfMesh, true);
auto material = std::make_shared<RenderMaterial>();
material->setDisplayMode(RenderMaterial::DisplayMode::WIREFRAME_SURFACE);
surfMesh->setRenderMaterial(material);
// d. Construct a map
......@@ -3422,7 +3426,7 @@ int main()
Test physics
------------------*/
testPbdVolume();
testPbdCloth();
//testPbdCloth();
//testPbdCollision();
//testPbdFluidBenchmarking();
//testPbdFluid();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment