------------------------------------------------------------------------------
| 1267 | |
| 1268 | //------------------------------------------------------------------------------ |
| 1269 | int vtkReebGraph::Implementation::SimplifyBranches( |
| 1270 | double simplificationThreshold, vtkReebGraphSimplificationMetric* simplificationMetric) |
| 1271 | { |
| 1272 | static const vtkReebLabelTag RouteOld = 100; |
| 1273 | static const vtkReebLabelTag RouteNew = 200; |
| 1274 | int nstack, mstack = 0; |
| 1275 | int* stack = nullptr; |
| 1276 | |
| 1277 | if (!simplificationThreshold) |
| 1278 | return 0; |
| 1279 | |
| 1280 | int nsimp = 0; |
| 1281 | int cont = 0; |
| 1282 | constexpr int step = 10000; |
| 1283 | bool redo; |
| 1284 | |
| 1285 | vtkDataSet* input = inputMesh; |
| 1286 | |
| 1287 | REDO: |
| 1288 | nstack = 0; |
| 1289 | redo = false; |
| 1290 | |
| 1291 | for (int N = 1; N < this->MainNodeTable.Size; ++N) |
| 1292 | { |
| 1293 | if (this->GetNode(N)->ArcUpId == -2) |
| 1294 | continue; |
| 1295 | |
| 1296 | vtkReebNode* n = this->GetNode(N); |
| 1297 | |
| 1298 | // simplify atomic nodes |
| 1299 | if (!n->ArcDownId && !n->ArcUpId) |
| 1300 | { |
| 1301 | // delete the node from the graph... |
| 1302 | this->GetNode(N)->ArcUpId = -2; |
| 1303 | this->GetNode(N)->ArcDownId = this->MainNodeTable.FreeZone; |
| 1304 | this->MainNodeTable.FreeZone = (N); |
| 1305 | --(this->MainNodeTable.Number); |
| 1306 | } |
| 1307 | else if (!n->ArcDownId) |
| 1308 | { |
| 1309 | // insert into stack branches to simplify |
| 1310 | for (int A_ = n->ArcUpId; A_; A_ = this->GetArc(A_)->ArcDwId0) |
| 1311 | { |
| 1312 | vtkReebArc* a_ = this->GetArc(A_); |
| 1313 | if ((!inputMesh) || (!simplificationMetric)) |
| 1314 | { |
| 1315 | if (vtkReebGraphGetArcPersistence(this, a_) < simplificationThreshold) |
| 1316 | { |
| 1317 | vtkReebGraphStackPush(A_); |
| 1318 | } |
| 1319 | } |
| 1320 | else |
| 1321 | { |
| 1322 | if (this->ComputeCustomMetric(simplificationMetric, a_) < simplificationThreshold) |
| 1323 | { |
| 1324 | vtkReebGraphStackPush(A_); |
| 1325 | } |
| 1326 | } |
no test coverage detected