------------------------------------------------------------------------------
| 106 | |
| 107 | //------------------------------------------------------------------------------ |
| 108 | void 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 | //------------------------------------------------------------------------------ |
| 149 | void vtkCameraHandleSource::RecomputeSphere() |
no test coverage detected