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

Method UpdateTensorEigenfunctions

Interaction/Widgets/vtkTensorRepresentation.cxx:1319–1341  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1317
1318//------------------------------------------------------------------------------
1319void vtkTensorRepresentation::UpdateTensorEigenfunctions(double tensor[3][3])
1320{
1321 // Now update the tensor information. The tensor data is sorted
1322 // from largest to smallest eigenvalues.
1323 double n[3]; // eigenvector norms
1324 int order[3] = { -1, -1, -1 };
1325 n[0] = vtkMath::Norm(tensor[0]);
1326 n[1] = vtkMath::Norm(tensor[1]);
1327 n[2] = vtkMath::Norm(tensor[2]);
1328 // NOLINTNEXTLINE(readability-avoid-nested-conditional-operator)
1329 order[0] = (n[0] >= n[1] ? (n[0] >= n[2] ? 0 : 2) : (n[1] >= n[2] ? 1 : 2)); // max
1330 // NOLINTNEXTLINE(readability-avoid-nested-conditional-operator)
1331 order[2] = (n[0] < n[1] ? (n[0] < n[2] ? 0 : 2) : (n[1] < n[2] ? 1 : 2)); // min
1332 order[1] = 3 - order[0] - order[2]; // neat trick ;-)
1333
1334 this->Eigenvalues[0] = n[order[0]];
1335 this->Eigenvalues[1] = n[order[1]];
1336 this->Eigenvalues[2] = n[order[2]];
1337
1338 std::copy(tensor[order[0]], tensor[order[0]] + 3, this->Eigenvectors[0]);
1339 std::copy(tensor[order[1]], tensor[order[1]] + 3, this->Eigenvectors[1]);
1340 std::copy(tensor[order[2]], tensor[order[2]] + 3, this->Eigenvectors[2]);
1341}
1342
1343//------------------------------------------------------------------------------
1344// Update the tensor ellipsoid, and associated widget/representation from the

Callers 1

Calls 2

NormFunction · 0.50
copyFunction · 0.50

Tested by

no test coverage detected