MCPcopy Create free account
hub / github.com/MITK/MITK / TestMoveSelectedVertex

Function TestMoveSelectedVertex

Modules/ContourModel/Testing/mitkContourModelTest.cpp:85–112  ·  view source on GitHub ↗

Move a vertex by a translation vector

Source from the content-addressed store, hash-verified

83
84// Move a vertex by a translation vector
85static void TestMoveSelectedVertex()
86{
87 mitk::ContourModel::Pointer contour = mitk::ContourModel::New();
88
89 mitk::Point3D p;
90 p[0] = p[1] = p[2] = 0;
91
92 contour->AddVertex(p);
93
94 // Same point is used here so the epsilon can be chosen very small
95 contour->SelectVertexAt(p, 0.01);
96
97 mitk::Vector3D v;
98 v[0] = 1;
99 v[1] = 3;
100 v[2] = -1;
101
102 contour->ShiftSelectedVertex(v);
103
104 const mitk::ContourModel::VertexType *vertex = contour->GetSelectedVertex();
105
106 bool correctlyMoved = false;
107
108 correctlyMoved =
109 (vertex->Coordinates)[0] == (v[0]) && (vertex->Coordinates)[1] == (v[1]) && (vertex->Coordinates)[2] == (v[2]);
110
111 MITK_TEST_CONDITION(correctlyMoved, "Vertex has been moved");
112}
113
114// Test to move the whole contour
115/*

Callers 1

mitkContourModelTestFunction · 0.85

Calls 4

SelectVertexAtMethod · 0.80
ShiftSelectedVertexMethod · 0.80
NewFunction · 0.50
AddVertexMethod · 0.45

Tested by

no test coverage detected