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

Method SetTensor

Interaction/Widgets/vtkTensorRepresentation.cxx:303–329  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Given a 3x3 symmetric tensor, update the widget accordingly.

Source from the content-addressed store, hash-verified

301//------------------------------------------------------------------------------
302// Given a 3x3 symmetric tensor, update the widget accordingly.
303void vtkTensorRepresentation::SetTensor(double tensor[9])
304{
305 std::copy(tensor, tensor + 9, this->Tensor);
306
307 // Evaluate eigenfunctions: set up working matrices
308 double *m[3], *v[3];
309 double m0[3], m1[3], m2[3];
310 m[0] = m0;
311 m[1] = m1;
312 m[2] = m2;
313 v[0] = this->Eigenvectors[0];
314 v[1] = this->Eigenvectors[1];
315 v[2] = this->Eigenvectors[2];
316
317 for (auto j = 0; j < 3; j++)
318 {
319 for (auto i = 0; i < 3; i++)
320 {
321 m[i][j] = 0.5 * (tensor[i + 3 * j] + tensor[j + 3 * i]);
322 }
323 }
324 vtkMath::Jacobi(m, this->Eigenvalues, v);
325
326 // Now update the widget/representation from the tensor
327 this->PositionHandles();
328 this->UpdateWidgetFromTensor();
329}
330
331//------------------------------------------------------------------------------
332// Set the position of the tensor. This means translating the representation.

Callers 2

SetSymmetricTensorMethod · 0.95
PlaceTensorMethod · 0.95

Calls 4

PositionHandlesMethod · 0.95
JacobiFunction · 0.85
copyFunction · 0.50

Tested by

no test coverage detected