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

Method UpdateWidgetFromTensor

Interaction/Widgets/vtkTensorRepresentation.cxx:1346–1387  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Update the tensor ellipsoid, and associated widget/representation from the current tensor specification. We'll use the current position.

Source from the content-addressed store, hash-verified

1344// Update the tensor ellipsoid, and associated widget/representation from the
1345// current tensor specification. We'll use the current position.
1346void vtkTensorRepresentation::UpdateWidgetFromTensor()
1347{
1348 // We are using the current tensor position
1349 double* pts = static_cast<vtkDoubleArray*>(this->Points->GetData())->GetPointer(0);
1350 double* center = pts + 3 * 14;
1351
1352 // We'll reset the points to be axis aligned, (-1,1,-1,1,-1,1) box.
1353 // The feed the eigenvectors into a transformation matrix and
1354 // transform the eight corner points.
1355 this->Points->SetPoint(0, -1, -1, -1);
1356 this->Points->SetPoint(1, 1, -1, -1);
1357 this->Points->SetPoint(2, 1, 1, -1);
1358 this->Points->SetPoint(3, -1, 1, -1);
1359 this->Points->SetPoint(4, -1, -1, 1);
1360 this->Points->SetPoint(5, 1, -1, 1);
1361 this->Points->SetPoint(6, 1, 1, 1);
1362 this->Points->SetPoint(7, -1, 1, 1);
1363
1364 this->EllipsoidTransform->Identity();
1365 this->EllipsoidTransform->Translate(center[0], center[1], center[2]);
1366 this->EllipsoidTransform->Scale(this->Eigenvalues);
1367
1368 for (auto j = 0; j < 3; ++j)
1369 {
1370 for (auto i = 0; i < 3; ++i)
1371 {
1372 this->EllipsoidMatrix->Element[i][j] = this->Eigenvectors[i][j];
1373 }
1374 }
1375 this->EllipsoidTransform->Concatenate(this->EllipsoidMatrix);
1376 this->EllipsoidTransform->Translate(-center[0], -center[1], -center[2]);
1377
1378 // Transform the 8 corner points
1379 this->TmpPoints->Reset();
1380 this->EllipsoidTransform->TransformPoints(this->Points, this->TmpPoints);
1381 for (auto i = 0; i < 8; i++)
1382 {
1383 this->Points->SetPoint(i, this->TmpPoints->GetPoint(i));
1384 }
1385
1386 this->PositionHandles();
1387}
1388
1389//------------------------------------------------------------------------------
1390int vtkTensorRepresentation::ComputeInteractionState(int X, int Y, int modify)

Callers 1

SetTensorMethod · 0.95

Calls 11

PositionHandlesMethod · 0.95
GetPointerMethod · 0.45
GetDataMethod · 0.45
SetPointMethod · 0.45
IdentityMethod · 0.45
TranslateMethod · 0.45
ScaleMethod · 0.45
ConcatenateMethod · 0.45
ResetMethod · 0.45
TransformPointsMethod · 0.45
GetPointMethod · 0.45

Tested by

no test coverage detected