------------------------------------------------------------------------------
| 211 | |
| 212 | //------------------------------------------------------------------------------ |
| 213 | double vtkWidgetRepresentation::SizeHandlesInPixels(double factor, double pos[3]) |
| 214 | { |
| 215 | // |
| 216 | int i; |
| 217 | vtkRenderer* renderer; |
| 218 | |
| 219 | if (!this->ValidPick || !(renderer = this->Renderer) || !renderer->GetActiveCamera()) |
| 220 | { |
| 221 | return (this->HandleSize * factor * this->InitialLength); |
| 222 | } |
| 223 | else |
| 224 | { |
| 225 | double radius, z; |
| 226 | double lowerLeft[4], upperRight[4]; |
| 227 | double focalPoint[4]; |
| 228 | |
| 229 | vtkInteractorObserver::ComputeWorldToDisplay( |
| 230 | this->Renderer, pos[0], pos[1], pos[2], focalPoint); |
| 231 | z = focalPoint[2]; |
| 232 | |
| 233 | double x = focalPoint[0] - this->HandleSize / 2.0; |
| 234 | double y = focalPoint[1] - this->HandleSize / 2.0; |
| 235 | vtkInteractorObserver::ComputeDisplayToWorld(this->Renderer, x, y, z, lowerLeft); |
| 236 | |
| 237 | x = focalPoint[0] + this->HandleSize / 2.0; |
| 238 | y = focalPoint[1] + this->HandleSize / 2.0; |
| 239 | vtkInteractorObserver::ComputeDisplayToWorld(this->Renderer, x, y, z, upperRight); |
| 240 | |
| 241 | for (radius = 0.0, i = 0; i < 3; i++) |
| 242 | { |
| 243 | radius += (upperRight[i] - lowerLeft[i]) * (upperRight[i] - lowerLeft[i]); |
| 244 | } |
| 245 | return (factor * (sqrt(radius) / 2.0)); |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | //------------------------------------------------------------------------------ |
| 250 | double vtkWidgetRepresentation::SizeHandlesRelativeToViewport(double factor, double pos[3]) |
no test coverage detected