------------------------------------------------------------------------------
| 125 | |
| 126 | //------------------------------------------------------------------------------ |
| 127 | double vtk3DWidget::SizeHandles(double factor) |
| 128 | { |
| 129 | int i; |
| 130 | vtkRenderer* renderer; |
| 131 | |
| 132 | if (!this->ValidPick || !(renderer = this->CurrentRenderer) || !renderer->GetActiveCamera()) |
| 133 | { |
| 134 | return (this->HandleSize * factor * this->InitialLength); |
| 135 | } |
| 136 | else |
| 137 | { |
| 138 | double radius, z; |
| 139 | double windowLowerLeft[4], windowUpperRight[4]; |
| 140 | double* viewport = renderer->GetViewport(); |
| 141 | const int* winSize = renderer->GetRenderWindow()->GetSize(); |
| 142 | double focalPoint[4]; |
| 143 | |
| 144 | this->ComputeWorldToDisplay( |
| 145 | this->LastPickPosition[0], this->LastPickPosition[1], this->LastPickPosition[2], focalPoint); |
| 146 | z = focalPoint[2]; |
| 147 | |
| 148 | double x = winSize[0] * viewport[0]; |
| 149 | double y = winSize[1] * viewport[1]; |
| 150 | this->ComputeDisplayToWorld(x, y, z, windowLowerLeft); |
| 151 | |
| 152 | x = winSize[0] * viewport[2]; |
| 153 | y = winSize[1] * viewport[3]; |
| 154 | this->ComputeDisplayToWorld(x, y, z, windowUpperRight); |
| 155 | |
| 156 | for (radius = 0.0, i = 0; i < 3; i++) |
| 157 | { |
| 158 | radius += |
| 159 | (windowUpperRight[i] - windowLowerLeft[i]) * (windowUpperRight[i] - windowLowerLeft[i]); |
| 160 | } |
| 161 | |
| 162 | return (sqrt(radius) * factor * this->HandleSize); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | //------------------------------------------------------------------------------ |
| 167 | void vtk3DWidget::PrintSelf(ostream& os, vtkIndent indent) |
no test coverage detected