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

Method CollapseVertex

Common/DataModel/vtkReebGraph.cxx:588–645  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

586
587//------------------------------------------------------------------------------
588void vtkReebGraph::Implementation::CollapseVertex(vtkIdType N, vtkReebNode* n)
589{
590 int Lb, Lnext, La;
591 vtkReebLabel* lb;
592
593 vtkIdType A0 = n->ArcDownId;
594 vtkIdType A1 = n->ArcUpId;
595
596 vtkReebArc* a0 = this->GetArc(A0);
597 vtkReebArc* a1 = this->GetArc(A1);
598
599 a0->NodeId1 = a1->NodeId1;
600 a0->ArcUpId1 = a1->ArcUpId1;
601
602 if (a1->ArcUpId1)
603 this->GetArc(a1->ArcUpId1)->ArcDwId1 = A0;
604
605 a0->ArcDwId1 = a1->ArcDwId1;
606
607 if (a1->ArcDwId1)
608 this->GetArc(a1->ArcDwId1)->ArcUpId1 = A0;
609
610 if (this->GetNode(a1->NodeId1)->ArcDownId == A1)
611 this->GetNode(a1->NodeId1)->ArcDownId = A0;
612
613 for (Lb = a1->LabelId0; Lb; Lb = Lnext)
614 {
615 lb = this->GetLabel(Lb);
616 Lnext = lb->HNext;
617
618 if (lb->VPrev)
619 {
620 La = lb->VPrev;
621 this->GetLabel(La)->VNext = lb->VNext;
622 }
623
624 if (lb->VNext)
625 this->GetLabel(lb->VNext)->VPrev = lb->VPrev;
626
627 // delete the label...
628 this->GetLabel(Lb)->HNext = -2;
629 this->GetLabel(Lb)->ArcId = this->MainLabelTable.FreeZone;
630 this->MainLabelTable.FreeZone = (Lb);
631 --(this->MainLabelTable.Number);
632 }
633
634 // delete the arc from the graph...
635 this->GetArc(A1)->LabelId1 = -2;
636 this->GetArc(A1)->LabelId0 = this->MainArcTable.FreeZone;
637 this->MainArcTable.FreeZone = (A1);
638 --(this->MainArcTable.Number);
639
640 // delete the node from the graph...
641 this->GetNode(N)->ArcUpId = -2;
642 this->GetNode(N)->ArcDownId = this->MainNodeTable.FreeZone;
643 this->MainNodeTable.FreeZone = (N);
644 --(this->MainNodeTable.Number);
645}

Callers 2

CollapseMethod · 0.95
EndVertexMethod · 0.95

Calls 3

GetArcMethod · 0.95
GetNodeMethod · 0.95
GetLabelMethod · 0.95

Tested by

no test coverage detected