Predictable output for vtkTensorGlyph on non-symmetric tensors

Previous version implicitly assumed that the tensor was symmetric
when using eigenvalue decomposition. General tensors have
non-real eigenvalues and eigenvectors.
It did not crash on general input because vtkMath::Jacobi expects
real symmetric matrix, and only use the upper right triangular
part of the matrix. So computations were as if the lower
triangular part of the tensor was symmetric of its the upper
triangular part.
It make more sense to apply the eigenvalue decomposition to the
symmetrical part of the tensor.
parent 12637271
 ... ... @@ -646,6 +646,7 @@ void vtkMath::LUSolveLinearSystem(double **A, int *index, // output eigenvalues in w; and output eigenvectors in v. Resulting // eigenvalues/vectors are sorted in decreasing order; eigenvectors are // normalized. // It assumes a is symmetric and uses only its upper right triangular part. template int vtkJacobiN(T **a, int n, T *w, T **v) { ... ...
 ... ... @@ -279,11 +279,13 @@ int vtkTensorGlyph::RequestData( // compute orientation vectors and scale factors from tensor if ( this->ExtractEigenvalues ) // extract appropriate eigenfunctions { // We are interested in the symmetrical part of the tensor only, since // eigenvalues are real if and only if the matrice of reals is symmetrical for (j=0; j<3; j++) { for (i=0; i<3; i++) { m[i][j] = tensor[i+3*j]; m[i][j] = 0.5 * (tensor[i + 3 * j] + tensor[j + 3 * i]); } } vtkMath::Jacobi(m, w, v); ... ...
 ... ... @@ -14,15 +14,19 @@ =========================================================================*/ /** * @class vtkTensorGlyph * @brief scale and orient glyph(s) according to tensor eigenvalues and eigenvectors * @brief scale and orient glyph(s) according to eigenvalues and eigenvectors of symmetrical part of tensor * * vtkTensorGlyph is a filter that copies a geometric representation * (specified as polygonal data) to every input point. The geometric * representation, or glyph, can be scaled and/or rotated according to * the tensor at the input point. Scaling and rotation is controlled * by the eigenvalues/eigenvectors of the tensor as follows. For each * tensor, the eigenvalues (and associated eigenvectors) are sorted to * determine the major, medium, and minor eigenvalues/eigenvectors. * by the eigenvalues/eigenvectors of the symmetrical part of the tensor * as follows: * For each tensor, the eigenvalues (and associated eigenvectors) are sorted * to determine the major, medium, and minor eigenvalues/eigenvectors. * The eigenvalue decomposition only makes sense for symmetric tensors, * hence the need to only consider the symmetric part of the tensor, which is * 1/2 (T + T.transposed()). * * If the boolean variable ThreeGlyphs is not set the major eigenvalue * scales the glyph in the x-direction, the medium in the y-direction, ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!