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

Method SizeHandlesInPixels

Interaction/Widgets/vtkWidgetRepresentation.cxx:213–247  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

211
212//------------------------------------------------------------------------------
213double 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//------------------------------------------------------------------------------
250double vtkWidgetRepresentation::SizeHandlesRelativeToViewport(double factor, double pos[3])

Callers 8

BuildRepresentationMethod · 0.80
TranslateMethod · 0.80
SizeBoundsMethod · 0.80
SizeHandlesMethod · 0.80
SizeHandlesMethod · 0.80
SizeHandlesMethod · 0.80
SizeBoundsMethod · 0.80

Calls 2

GetActiveCameraMethod · 0.80
sqrtFunction · 0.50

Tested by

no test coverage detected