------------------------------------------------------------------------------ Set the distance of the focal point from the camera. The focal point is modified accordingly. This should be positive.
| 573 | // Set the distance of the focal point from the camera. The focal point is |
| 574 | // modified accordingly. This should be positive. |
| 575 | void 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 |