MCPcopy Create free account
hub / github.com/Kitware/VTK / SimplifyLoops

Method SimplifyLoops

Common/DataModel/vtkReebGraph.cxx:1128–1228  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1126
1127//------------------------------------------------------------------------------
1128int vtkReebGraph::Implementation::SimplifyLoops(
1129 double simplificationThreshold, vtkReebGraphSimplificationMetric* simplificationMetric)
1130{
1131
1132 if (!simplificationThreshold)
1133 return 0;
1134
1135 // refresh information about ArcLoopTable
1136 this->FindLoops();
1137
1138 int NumSimplified = 0;
1139
1140 for (int n = 0; n < this->LoopNumber; n++)
1141 {
1142 int A = this->ArcLoopTable[n];
1143
1144 if (this->GetArc(A)->LabelId1 == -2)
1145 continue;
1146
1147 double simplificationValue = 0;
1148 if ((!inputMesh) || (!simplificationMetric))
1149 {
1150 vtkIdType N0 = this->GetArc(A)->NodeId0;
1151 vtkIdType N1 = this->GetArc(A)->NodeId1;
1152 double f0 = this->GetNode(N0)->Value;
1153 double f1 = this->GetNode(N1)->Value;
1154 simplificationValue = (f1 - f0) / (this->MaximumScalarValue - this->MinimumScalarValue);
1155 }
1156 else
1157 {
1158 simplificationValue = ComputeCustomMetric(simplificationMetric, this->GetArc(A));
1159 }
1160
1161 if (simplificationValue >= simplificationThreshold)
1162 continue;
1163
1164 vtkReebPath entry =
1165 this->FindPath(this->ArcLoopTable[n], simplificationThreshold, simplificationMetric);
1166
1167 // too high for persistence
1168 if (entry.SimplificationValue >= simplificationThreshold)
1169 continue;
1170
1171 // distribute its bucket to the loop and delete the arc
1172 this->FastArcSimplify(ArcLoopTable[n], entry.ArcNumber, entry.ArcTable);
1173 delete entry.ArcTable;
1174 delete entry.NodeTable;
1175
1176 ++NumSimplified;
1177 CommitSimplification();
1178 }
1179
1180 // check for regular points
1181 for (int N = 1; N < this->MainNodeTable.Size; N++)
1182 {
1183 if (this->GetNode(N)->ArcUpId == -2)
1184 continue;
1185

Callers 1

SimplifyMethod · 0.80

Calls 7

FindLoopsMethod · 0.95
GetArcMethod · 0.95
GetNodeMethod · 0.95
FindPathMethod · 0.95
FastArcSimplifyMethod · 0.95
emplace_backMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected