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

Method RecomputeArrows

Interaction/Widgets/vtkCameraHandleSource.cxx:108–146  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

106
107//------------------------------------------------------------------------------
108void vtkCameraHandleSource::RecomputeArrows()
109{
110 double arrowOrigin[3];
111 this->GetPosition(arrowOrigin);
112 double rotationAxis[3];
113 double rotationAngle;
114 double baseVector[3] = { 1, 0, 0 };
115
116 this->UpTransform->Identity();
117 this->FrontTransform->Identity();
118
119 vtkMatrix4x4* matrix = this->Camera->GetModelViewTransformMatrix();
120 double ViewUp[3];
121
122 ViewUp[0] = matrix->GetElement(1, 0);
123 ViewUp[1] = matrix->GetElement(1, 1);
124 ViewUp[2] = matrix->GetElement(1, 2);
125
126 vtkMath::Normalize(ViewUp);
127 rotationAngle = vtkMath::AngleBetweenVectors(baseVector, ViewUp);
128 vtkMath::Cross(baseVector, ViewUp, rotationAxis);
129 vtkMath::Normalize(rotationAxis);
130
131 this->UpTransform->Scale(this->Size * 2, this->Size * 3, this->Size * 3);
132 this->UpTransform->RotateWXYZ(vtkMath::DegreesFromRadians(rotationAngle), rotationAxis);
133 this->UpTransform->Translate(arrowOrigin);
134
135 double* ViewFront = this->Camera->GetDirectionOfProjection();
136 vtkMath::Normalize(ViewFront);
137 rotationAngle = vtkMath::AngleBetweenVectors(baseVector, ViewFront);
138 vtkMath::Cross(baseVector, ViewFront, rotationAxis);
139 vtkMath::Normalize(rotationAxis);
140
141 this->FrontTransform->Scale(this->Size * 4, this->Size * 4, this->Size * 4);
142 this->FrontTransform->RotateWXYZ(vtkMath::DegreesFromRadians(rotationAngle), rotationAxis);
143 this->FrontTransform->Translate(arrowOrigin);
144
145 this->ArrowsAppend->Update();
146}
147
148//------------------------------------------------------------------------------
149void vtkCameraHandleSource::RecomputeSphere()

Callers 1

RequestDataMethod · 0.95

Calls 9

GetPositionMethod · 0.95
RotateWXYZMethod · 0.80
NormalizeFunction · 0.50
CrossFunction · 0.50
IdentityMethod · 0.45
ScaleMethod · 0.45
TranslateMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected