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

Method UpdateTensorFromWidget

Interaction/Widgets/vtkTensorRepresentation.cxx:1272–1316  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Update the tensor ellipsoid, and associated tensor data (e.g., eigenvalues) from the current widget/representation state.

Source from the content-addressed store, hash-verified

1270// Update the tensor ellipsoid, and associated tensor data (e.g., eigenvalues)
1271// from the current widget/representation state.
1272void vtkTensorRepresentation::UpdateTensorFromWidget()
1273{
1274 // Obtain the points defining the representation
1275 double* pts = static_cast<vtkDoubleArray*>(this->Points->GetData())->GetPointer(0);
1276 double* center = pts + 3 * 14;
1277 double* x = pts + 3 * 9;
1278 double* y = pts + 3 * 11;
1279 double* z = pts + 3 * 13;
1280
1281 // Gather information about the representation: size (norm) of semi-axes;
1282 // and the semi-axes vectors. These are the eigenvectors and values of the
1283 // tensor.
1284 double tensor[3][3];
1285 for (auto i = 0; i < 3; ++i)
1286 {
1287 tensor[i][0] = x[i] - center[i];
1288 tensor[i][1] = y[i] - center[i];
1289 tensor[i][2] = z[i] - center[i];
1290 }
1291
1292 // Use the internal transforms to perform the transformation of the
1293 // ellipsoid.
1294 this->EllipsoidTransform->Identity();
1295
1296 // Translate to center of widget
1297 this->EllipsoidTransform->Translate(center);
1298
1299 // Next scale and rotate the ellipsoid based on the eigenvectors (which are
1300 // simply the semi-axes of the widget representation).
1301 for (auto j = 0; j < 3; ++j)
1302 {
1303 for (auto i = 0; i < 3; ++i)
1304 {
1305 this->EllipsoidMatrix->Element[i][j] = tensor[i][j];
1306 }
1307 }
1308 this->EllipsoidTransform->Concatenate(this->EllipsoidMatrix);
1309
1310 // Specify total transformation
1311 // this->EllipsoidTransform->Modified();
1312
1313 // Now update the tensor information
1314 std::copy(center, center + 3, this->TensorPosition);
1315 this->UpdateTensorEigenfunctions(tensor);
1316}
1317
1318//------------------------------------------------------------------------------
1319void vtkTensorRepresentation::UpdateTensorEigenfunctions(double tensor[3][3])

Callers 12

MovePlusXFaceMethod · 0.95
MoveMinusXFaceMethod · 0.95
MovePlusYFaceMethod · 0.95
MoveMinusYFaceMethod · 0.95
MovePlusZFaceMethod · 0.95
MoveMinusZFaceMethod · 0.95
TranslateMethod · 0.95
ScaleMethod · 0.95
RotateMethod · 0.95
UpdatePoseMethod · 0.95
PlaceWidgetMethod · 0.95
SetTensorEllipsoidMethod · 0.95

Calls 7

copyFunction · 0.50
GetPointerMethod · 0.45
GetDataMethod · 0.45
IdentityMethod · 0.45
TranslateMethod · 0.45
ConcatenateMethod · 0.45

Tested by

no test coverage detected