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

Function TestPyramid

Common/DataModel/Testing/Cxx/TestPyramid.cxx:40–58  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

38
39//-----------------------------------------------------------------------------
40int TestPyramid(int, char*[])
41{
42 constexpr double tol = 0.000001;
43
44 vtkNew<vtkPyramid> pyramid;
45 pyramid->GetPoints()->SetPoint(0, 1.0, 1.0, 1.0);
46 pyramid->GetPoints()->SetPoint(1, -1.0, 1.0, 1.0);
47 pyramid->GetPoints()->SetPoint(2, -1.0, -1.0, 1.0);
48 pyramid->GetPoints()->SetPoint(3, 1.0, -1.0, 1.0);
49 pyramid->GetPoints()->SetPoint(4, 0.0, 0.0, 0.0);
50
51 // Testing vtkPyramid::ComputeCentroid and vtkPyramid::GetCentroid
52 std::array<double, 3> centroid;
53 bool res = pyramid->GetCentroid(centroid.data());
54 VTK_REQUIRE(res, "vtkPyramid::GetCentroid FAILED: couldn't determine centroid");
55 VTK_REQUIRE(FuzzyCompare(centroid, { 0.0, 0.0, 0.75 }, tol),
56 "vtkPyramid::GetCentroid FAILED: wrong centroid");
57 return EXIT_SUCCESS;
58}

Callers

nothing calls this directly

Calls 5

FuzzyCompareFunction · 0.70
SetPointMethod · 0.45
GetPointsMethod · 0.45
GetCentroidMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected