Rendering/vtkCamera.cxx
void vtkCamera::ComputeDistance()
{
  double dx = this->FocalPoint[0] - this->Position[0];
  double dy = this->FocalPoint[1] - this->Position[1];
  double dz = this->FocalPoint[2] - this->Position[2];

  this->Distance = sqrt(dx*dx + dy*dy + dz*dz);

  if (this->Distance < 1e-20)
    {
    this->Distance = 1e-20;
    vtkDebugMacro(<< " Distance is set to minimum.");

    double *vec = this->DirectionOfProjection;

// recalculate FocalPoint
    this->FocalPoint[0] = this->Position[0] + vec[0]*this->Distance;
    this->FocalPoint[1] = this->Position[1] + vec[1]*this->Distance;
    this->FocalPoint[2] = this->Position[2] + vec[2]*this->Distance;
    }

  this->DirectionOfProjection[0] = dx/this->Distance;
  this->DirectionOfProjection[1] = dy/this->Distance;
  this->DirectionOfProjection[2] = dz/this->Distance;

  this->ComputeViewPlaneNormal();
}
//----------------------------------------------------------------------------
// This method must be called when the focal point or camera position changes
This method must be called when the focal point or camera position changes
This method must be called when the focal point or camera position changes
void vtkCamera::ComputeDistance()
{
  double dx = this->FocalPoint[0] - this->Position[0];
  double dy = this->FocalPoint[1] - this->Position[1];
  double dz = this->FocalPoint[2] - this->Position[2];
  this->Distance = sqrt(dx*dx + dy*dy + dz*dz);
  if (this->Distance < 1e-20)
    {
    this->Distance = 1e-20;
    vtkDebugMacro(<< " Distance is set to minimum.");
    double *vec = this->DirectionOfProjection;
    this->FocalPoint[0] = this->Position[0] + vec[0]*this->Distance;
    this->FocalPoint[1] = this->Position[1] + vec[1]*this->Distance;
    this->FocalPoint[2] = this->Position[2] + vec[2]*this->Distance;
    }
  this->DirectionOfProjection[0] = dx/this->Distance;
  this->DirectionOfProjection[1] = dy/this->Distance;
  this->DirectionOfProjection[2] = dz/this->Distance;
  this->ComputeViewPlaneNormal();
}
void vtkCamera :: ComputeDistance ( ) { double dx = this -> FocalPoint [ 0 ] - this -> Position [ 0 ] ; double dy = this -> FocalPoint [ 1 ] - this -> Position [ 1 ] ; double dz = this -> FocalPoint [ 2 ] - this -> Position [ 2 ] ; this -> Distance = sqrt ( dx * dx + dy * dy + dz * dz ) ; if ( this -> Distance < 1e-20 ) { this -> Distance = 1e-20 ; vtkDebugMacro ( << " " ) ; double * vec = this -> DirectionOfProjection ; this -> FocalPoint [ 0 ] = this -> Position [ 0 ] + vec [ 0 ] * this -> Distance ; this -> FocalPoint [ 1 ] = this -> Position [ 1 ] + vec [ 1 ] * this -> Distance ; this -> FocalPoint [ 2 ] = this -> Position [ 2 ] + vec [ 2 ] * this -> Distance ; } this -> DirectionOfProjection [ 0 ] = dx / this -> Distance ; this -> DirectionOfProjection [ 1 ] = dy / this -> Distance ; this -> DirectionOfProjection [ 2 ] = dz / this -> Distance ; this -> ComputeViewPlaneNormal ( ) ; }
This method must be called when the focal point or camera position changes
This method must be called when the focal point or camera position changes
// recalculate FocalPoint