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

Function MakeCube

Common/DataModel/Testing/Cxx/UnitTestCells.cxx:753–797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

751}
752
753vtkSmartPointer<vtkPolyhedron> MakeCube()
754{
755 auto aCube = vtkSmartPointer<vtkPolyhedron>::New();
756
757 // create polyhedron (cube)
758 auto points = vtkSmartPointer<vtkPoints>::New();
759
760 aCube->GetPointIds()->SetNumberOfIds(8);
761 aCube->GetPointIds()->SetId(0, 0);
762 aCube->GetPointIds()->SetId(1, 1);
763 aCube->GetPointIds()->SetId(2, 2);
764 aCube->GetPointIds()->SetId(3, 3);
765 aCube->GetPointIds()->SetId(4, 4);
766 aCube->GetPointIds()->SetId(5, 5);
767 aCube->GetPointIds()->SetId(6, 6);
768 aCube->GetPointIds()->SetId(7, 7);
769
770 aCube->GetPoints()->SetNumberOfPoints(8);
771 aCube->GetPoints()->SetPoint(0, -1.0, -1.0, -1.0);
772 aCube->GetPoints()->SetPoint(1, 1.0, -1.0, -1.0);
773 aCube->GetPoints()->SetPoint(2, 1.0, 1.0, -1.0);
774 aCube->GetPoints()->SetPoint(3, -1.0, 1.0, -1.0);
775 aCube->GetPoints()->SetPoint(4, -1.0, -1.0, 1.0);
776 aCube->GetPoints()->SetPoint(5, 1.0, -1.0, 1.0);
777 aCube->GetPoints()->SetPoint(6, 1.0, 1.0, 1.0);
778 aCube->GetPoints()->SetPoint(7, -1.0, 1.0, 1.0);
779
780 vtkIdType face_conns[24] = {
781 0, 3, 2, 1, //
782 0, 4, 7, 3, //
783 4, 5, 6, 7, //
784 5, 1, 2, 6, //
785 0, 1, 5, 4, //
786 2, 3, 7, 6 //
787 };
788 vtkNew<vtkCellArray> faces;
789 vtkNew<vtkIdTypeArray> conns_arr;
790 conns_arr->SetArray(face_conns, 24, 1);
791 faces->SetData(4, conns_arr);
792
793 aCube->SetCellFaces(faces);
794 aCube->Initialize();
795
796 return aCube;
797}
798
799vtkSmartPointer<vtkPolyhedron> MakeDodecahedron()
800{

Callers 1

UnitTestCellsFunction · 0.70

Calls 11

SetNumberOfIdsMethod · 0.80
NewFunction · 0.50
GetPointIdsMethod · 0.45
SetIdMethod · 0.45
SetNumberOfPointsMethod · 0.45
GetPointsMethod · 0.45
SetPointMethod · 0.45
SetArrayMethod · 0.45
SetDataMethod · 0.45
SetCellFacesMethod · 0.45
InitializeMethod · 0.45

Tested by

no test coverage detected