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

Method SetDistance

Rendering/Core/vtkCamera.cxx:575–604  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Set the distance of the focal point from the camera. The focal point is modified accordingly. This should be positive.

Source from the content-addressed store, hash-verified

573// Set the distance of the focal point from the camera. The focal point is
574// modified accordingly. This should be positive.
575void vtkCamera::SetDistance(double d)
576{
577 if (this->Distance == d)
578 {
579 return;
580 }
581
582 this->Distance = d;
583
584 // Distance should be greater than .0002
585 if (this->Distance < 0.0002)
586 {
587 this->Distance = 0.0002;
588 vtkDebugMacro(<< " Distance is set to minimum.");
589 }
590
591 // we want to keep the camera pointing in the same direction
592 double* vec = this->DirectionOfProjection;
593
594 // recalculate FocalPoint
595 this->FocalPoint[0] = this->Position[0] + vec[0] * this->Distance;
596 this->FocalPoint[1] = this->Position[1] + vec[1] * this->Distance;
597 this->FocalPoint[2] = this->Position[2] + vec[2] * this->Distance;
598
599 vtkDebugMacro(<< " Distance set to ( " << this->Distance << ")");
600
601 this->ComputeViewTransform();
602 this->ComputeCameraLightTransform();
603 this->Modified();
604}
605
606//------------------------------------------------------------------------------
607// This method must be called when the focal point or camera position changes

Calls 3

ComputeViewTransformMethod · 0.95
ModifiedMethod · 0.45

Tested by 5

TestPolyDataPointSamplerFunction · 0.36
testMultipleCellTypesMethod · 0.36
runCaseMethod · 0.36