Skip to content

Commit

Permalink
stkCGALSelfIntersectionMeasurer: Verbose Toggle
Browse files Browse the repository at this point in the history
XML
  • Loading branch information
ArtemNzk committed Oct 21, 2022
1 parent 46504ff commit 67fa7f1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 10 deletions.
13 changes: 13 additions & 0 deletions src/Resources/stkCGALSelfIntersectionMeasurer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,18 @@
</Hints>
</StringVectorProperty>

<IntVectorProperty
name="Verbose"
command="SetVerbose"
number_of_elements="1"
default_values="0"
panel_visibility="advanced">
<BooleanDomain name="bool" />
<Documentation>
Output Debug Messages.
</Documentation>
</IntVectorProperty>

<PropertyGroup label="Measure Self-Intersections">
<Property name="SelfIntersectionsArrayName" />
<Property name="IterateByConnectivity" />
Expand All @@ -220,6 +232,7 @@
<PropertyGroup label="Debugging">
<Property name="OutputNullFaceMaskArray" />
<Property name="NullFaceMaskArrayName" />
<Property name="Verbose" />
</PropertyGroup>

</Proxy>
Expand Down
37 changes: 27 additions & 10 deletions src/stkCGALSelfIntersectionMeasurer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ int stkCGALSelfIntersectionMeasurer::RequestData(vtkInformation* vtkNotUsed(requ
if (polyData->GetNumberOfCells() == 0)
continue;

std::cout << "====== Region " << i << " ======" << std::endl;
if (this->Verbose)
{
std::cout << "====== Region " << i << " ======" << std::endl;
}

vtkNew<vtkPolyData> singlePoly;
vtkNew<vtkPolyData> tempPoly;
Expand Down Expand Up @@ -177,21 +180,30 @@ int stkCGALSelfIntersectionMeasurer::ExecuteSelfIntersect(

if (intersected_tris.size() == 0)
{
vtkWarningMacro("No Self-Intersections were found in the mesh. "
<< intersected_tris.size() << " pairs of triangles intersect.");
if (this->Verbose)
{
vtkWarningMacro("No Self-Intersections were found in the mesh. "
<< intersected_tris.size() << " pairs of triangles intersect.");
}
}
else
{
vtkWarningMacro("Self-Intersections were found in the mesh. "
<< intersected_tris.size() << " pairs of triangles intersect.");
if (this->Verbose)
{
vtkWarningMacro("Self-Intersections were found in the mesh. "
<< intersected_tris.size() << " pairs of triangles intersect.");
}
}

if (this->PrintSelfIntersectingPairs)
{
for (auto i = 0; i < intersected_tris.size(); ++i)
{
vtkWarningMacro("Triangle " << intersected_tris[i].first.idx() << " is intersecting with "
<< intersected_tris[i].second.idx() << ".");
if (this->Verbose)
{
vtkWarningMacro("Triangle " << intersected_tris[i].first.idx() << " is intersecting with "
<< intersected_tris[i].second.idx() << ".");
}
}
}

Expand Down Expand Up @@ -226,8 +238,10 @@ int stkCGALSelfIntersectionMeasurer::ExecuteRepairSelfIntersect(

if (intersecting)
{
vtkWarningMacro("Found some Self-Intersections.Trying to Repair Self-Intersections");

if (this->Verbose)
{
vtkWarningMacro("Found some Self-Intersections.Trying to Repair Self-Intersections");
}
vtkNew<vtkIdTypeArray> OrginalIDArray;

// Most of the code below is replicated from the experimental remove_self_intersections method
Expand Down Expand Up @@ -303,7 +317,10 @@ int stkCGALSelfIntersectionMeasurer::ExecuteRepairSelfIntersect(
topology_issue = result_pair.second;
}

vtkWarningMacro(<< "Done Repairing. Measuring Self-intersection in the repaired mesh");
if (this->Verbose)
{
vtkWarningMacro(<< "Done Repairing. Measuring Self-intersection in the repaired mesh");
}

stkCGALUtilities::SurfaceMeshToPolyData(surfaceMesh, polyDataOut);

Expand Down

0 comments on commit 67fa7f1

Please sign in to comment.