{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl{\f0\fnil\fprq1\fcharset0 Courier New;}{\f1\fnil\fcharset0 Courier New;}}
{\colortbl ;\red0\green128\blue0;\red0\green0\blue255;}
{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\cf1\f0\fs20 /*=========================================================================\par
\par
  Program:   Visualization Toolkit\par
  Module:    $RCSfile: vtkCamera.cxx,v $\par
\par
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\par
  All rights reserved.\par
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\par
\par
     This software is distributed WITHOUT ANY WARRANTY; without even\par
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\par
     PURPOSE.  See the above copyright notice for more information.\par
\par
=========================================================================*/\par
\cf2 #include\cf0  "vtkCamera.h"\par
\par
\cf2 #include\cf0  "vtkMath.h"\par
\cf2 #include\cf0  "vtkTimeStamp.h"\par
\cf2 #include\cf0  "vtkGraphicsFactory.h"\par
\cf2 #include\cf0  "vtkPerspectiveTransform.h"\par
\cf2 #include\cf0  "vtkTransform.h"\par
\par
\cf2 #include\cf0  <math.h>\par
\par
vtkCxxRevisionMacro(vtkCamera, "$Revision: 1.109 $");\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Needed when we don't use the vtkStandardNewMacro.\par
\cf0 vtkInstantiatorNewMacro(vtkCamera);\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Construct camera instance with its focal point at the origin, \par
// and position=(0,0,1). The view up is along the y-axis, \par
// view angle is 30 degrees, and the clipping range is (.1,1000).\par
\cf0 vtkCamera::vtkCamera()\par
\{\par
  \cf2 this\cf0 ->FocalPoint[0] = 0.0;\par
  \cf2 this\cf0 ->FocalPoint[1] = 0.0;\par
  \cf2 this\cf0 ->FocalPoint[2] = 0.0;\par
\par
  \cf2 this\cf0 ->Position[0] = 0.0;\par
  \cf2 this\cf0 ->Position[1] = 0.0;\par
  \cf2 this\cf0 ->Position[2] = 1.0;\par
\par
  \cf2 this\cf0 ->ViewUp[0] = 0.0;\par
  \cf2 this\cf0 ->ViewUp[1] = 1.0;\par
  \cf2 this\cf0 ->ViewUp[2] = 0.0;\par
\par
  \cf2 this\cf0 ->DirectionOfProjection[0] = 0.0;\par
  \cf2 this\cf0 ->DirectionOfProjection[1] = 0.0;\par
  \cf2 this\cf0 ->DirectionOfProjection[2] = 0.0;\par
\par
  \cf2 this\cf0 ->ViewAngle = 30.0;\par
  \cf2 this\cf0 ->UseHorizontalViewAngle = 0;\par
\par
  \cf2 this\cf0 ->ClippingRange[0] = 0.01;\par
  \cf2 this\cf0 ->ClippingRange[1] = 1000.01;\par
  \cf2 this\cf0 ->Thickness = 1000.0;\par
\par
  \cf2 this\cf0 ->ParallelProjection = 0;\par
  \cf2 this\cf0 ->ParallelScale = 1.0;\par
 \par
  \cf2 this\cf0 ->EyeAngle = 2.0;\par
  \cf2 this\cf0 ->Stereo = 0;\par
  \cf2 this\cf0 ->LeftEye = 1;\par
\par
  \cf2 this\cf0 ->WindowCenter[0] = 0.0;\par
  \cf2 this\cf0 ->WindowCenter[1] = 0.0;\par
  \par
  \cf2 this\cf0 ->ViewShear[0] = 0.0;\par
  \cf2 this\cf0 ->ViewShear[1] = 0.0;\par
  \cf2 this\cf0 ->ViewShear[2] = 1.0;\par
\par
  \cf2 this\cf0 ->FocalDisk = 1.0;\par
\par
  \cf2 this\cf0 ->Transform = vtkPerspectiveTransform::New();\par
  \cf2 this\cf0 ->ViewTransform = vtkTransform::New();\par
  \cf2 this\cf0 ->PerspectiveTransform = vtkPerspectiveTransform::New();\par
  \cf2 this\cf0 ->CameraLightTransform = vtkTransform::New();\par
  \cf2 this\cf0 ->UserTransform = NULL;\par
\par
  \cf1 // initialize the ViewTransform\par
\cf0   \cf2 this\cf0 ->ComputeViewTransform();\par
  \cf2 this\cf0 ->ComputeDistance();\par
  \cf2 this\cf0 ->ComputeCameraLightTransform();\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf0 vtkCamera::~vtkCamera()\par
\{\par
  \cf2 this\cf0 ->Transform->Delete();\par
  \cf2 this\cf0 ->ViewTransform->Delete();\par
  \cf2 this\cf0 ->PerspectiveTransform->Delete();\par
  \cf2 this\cf0 ->CameraLightTransform->Delete();\par
  \cf2 if\cf0  (\cf2 this\cf0 ->UserTransform)\par
    \{\par
    \cf2 this\cf0 ->UserTransform->UnRegister(\cf2 this\cf0 );\par
    \cf2 this\cf0 ->UserTransform = NULL;\par
    \}\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// return the correct type of Camera \par
\cf0 vtkCamera *vtkCamera::New()\par
\{\par
  \cf1 // First try to create the object from the vtkObjectFactory\par
\cf0   vtkObject* ret = vtkGraphicsFactory::CreateInstance("vtkCamera");\par
  \cf2 return\cf0  (vtkCamera*)ret;\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
//----------------------------------------------------------------------------\par
// The first set of methods deal exclusively with the ViewTransform, which\par
// is the only transform which is set up entirely in the camera.  The\par
// perspective transform must be set up by the Renderer because the \par
// Camera doesn't know the Renderer's aspect ratio.\par
//----------------------------------------------------------------------------\par
//----------------------------------------------------------------------------\par
\par
//----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetPosition(\cf2 double\cf0  x, \cf2 double\cf0  y, \cf2 double\cf0  z)\par
\{\par
  \cf2 if\cf0  (x == \cf2 this\cf0 ->Position[0] && \par
      y == \cf2 this\cf0 ->Position[1] &&\par
      z == \cf2 this\cf0 ->Position[2])\par
    \{\par
    \cf2 return\cf0 ;\par
    \}\par
  \par
  \cf2 this\cf0 ->Position[0] = x;\par
  \cf2 this\cf0 ->Position[1] = y;\par
  \cf2 this\cf0 ->Position[2] = z;\par
\par
  vtkDebugMacro(<< " Position set to ( " <<  \cf2 this\cf0 ->Position[0] << ", " \par
                << \cf2 this\cf0 ->Position[1] << ", " << \cf2 this\cf0 ->Position[2] << ")");\par
\par
  \cf2 this\cf0 ->ComputeViewTransform();\par
  \cf1 // recompute the focal distance\par
\cf0   \cf2 this\cf0 ->ComputeDistance();\par
  \cf2 this\cf0 ->ComputeCameraLightTransform();\par
\par
  \cf2 this\cf0 ->Modified();\par
\}\par
\par
\cf2 void\cf0  vtkCamera::SetUserTransform(vtkHomogeneousTransform *transform)\par
\{\par
  \cf2 if\cf0  (transform == \cf2 this\cf0 ->UserTransform) \par
    \{ \par
    \cf2 return\cf0 ; \par
    \}\par
  \cf2 if\cf0  (\cf2 this\cf0 ->UserTransform) \par
    \{\par
    \cf2 this\cf0 ->UserTransform->Delete();\par
    \cf2 this\cf0 ->UserTransform = NULL;\par
    \}\par
  \cf2 if\cf0  (transform)\par
    \{\par
    \cf2 this\cf0 ->UserTransform = transform;\par
    \cf2 this\cf0 ->UserTransform->Register(\cf2 this\cf0 );\par
    \}\par
  \cf2 this\cf0 ->Modified();\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetFocalPoint(\cf2 double\cf0  x, \cf2 double\cf0  y, \cf2 double\cf0  z)\par
\{\par
  \cf2 if\cf0  (x == \cf2 this\cf0 ->FocalPoint[0] && \par
      y == \cf2 this\cf0 ->FocalPoint[1] && \par
      z == \cf2 this\cf0 ->FocalPoint[2])\par
    \{\par
    \cf2 return\cf0 ;\par
    \}\par
\par
  \cf2 this\cf0 ->FocalPoint[0] = x; \par
  \cf2 this\cf0 ->FocalPoint[1] = y; \par
  \cf2 this\cf0 ->FocalPoint[2] = z;\par
\par
  vtkDebugMacro(<< " FocalPoint set to ( " <<  \cf2 this\cf0 ->FocalPoint[0] << ", " << \cf2 this\cf0 ->FocalPoint[1] << ", " << \cf2 this\cf0 ->FocalPoint[2] << ")");\par
\par
  \cf2 this\cf0 ->ComputeViewTransform();\par
  \cf1 // recompute the focal distance\par
\cf0   \cf2 this\cf0 ->ComputeDistance();\par
  \cf2 this\cf0 ->ComputeCameraLightTransform();\par
\par
  \cf2 this\cf0 ->Modified();\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetViewUp(\cf2 double\cf0  x, \cf2 double\cf0  y, \cf2 double\cf0  z)\par
\{\par
  \cf1 // normalize ViewUp, but do _not_ orthogonalize it by default\par
\cf0   \cf2 double\cf0  norm = sqrt(x*x + y*y + z*z);\par
  \par
  \cf2 if\cf0 (norm != 0) \par
    \{\par
    x /= norm; \par
    y /= norm; \par
    z /= norm;\par
    \}\par
  \cf2 else\cf0  \par
    \{\par
    x = 0; \par
    y = 1; \par
    z = 0;\par
    \}\par
  \par
  \cf2 if\cf0  (x == \cf2 this\cf0 ->ViewUp[0] && \par
      y == \cf2 this\cf0 ->ViewUp[1] &&\par
      z == \cf2 this\cf0 ->ViewUp[2])\par
    \{\par
    \cf2 return\cf0 ;\par
    \}\par
\par
  \cf2 this\cf0 ->ViewUp[0] = x;\par
  \cf2 this\cf0 ->ViewUp[1] = y;\par
  \cf2 this\cf0 ->ViewUp[2] = z;\par
\par
  vtkDebugMacro(<< " ViewUp set to ( " <<  \cf2 this\cf0 ->ViewUp[0] << ", " << \cf2 this\cf0 ->ViewUp[1] << ", " << \cf2 this\cf0 ->ViewUp[2] << ")");\par
  \par
  \cf2 this\cf0 ->ComputeViewTransform();\par
  \cf2 this\cf0 ->ComputeCameraLightTransform();\par
  \cf2 this\cf0 ->Modified();\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// The ViewTransform depends on only three ivars:  the Position, the\par
// FocalPoint, and the ViewUp vector.  All the other methods are there\par
// simply for the sake of the users' convenience.\par
\cf2 void\cf0  vtkCamera::ComputeViewTransform()\par
\{\par
  \cf1 // main view through the camera\par
\cf0   \cf2 this\cf0 ->Transform->Identity();\par
  \cf2 this\cf0 ->Transform->SetupCamera(\cf2 this\cf0 ->Position, \cf2 this\cf0 ->FocalPoint, \cf2 this\cf0 ->ViewUp);\par
  \cf2 this\cf0 ->ViewTransform->SetMatrix(\cf2 this\cf0 ->Transform->GetMatrix());\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::ComputeCameraLightTransform()\par
\{\par
  vtkTransform *t;\par
  \cf2 double\cf0  d;\par
\par
  \cf1 // assumes a valid view transform and valid camera distance\par
\par
\cf0   t = \cf2 this\cf0 ->CameraLightTransform;\par
  t->Identity();\par
  t->SetMatrix(\cf2 this\cf0 ->ViewTransform->GetMatrix());\par
  t->Inverse();\par
\par
  d = \cf2 this\cf0 ->Distance;\par
  t->Scale(d, d, d);\par
  t->Translate(0.0, 0.0, -1.0);\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::OrthogonalizeViewUp()\par
\{\par
  \cf1 // the orthogonalized ViewUp is just the second row of the view matrix\par
\cf0   vtkMatrix4x4 *matrix = \cf2 this\cf0 ->ViewTransform->GetMatrix();\par
  \cf2 this\cf0 ->ViewUp[0] = matrix->GetElement(1,0);\par
  \cf2 this\cf0 ->ViewUp[1] = matrix->GetElement(1,1);\par
  \cf2 this\cf0 ->ViewUp[2] = matrix->GetElement(1,2);\par
\par
  \cf2 this\cf0 ->Modified();\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Set the distance of the focal point from the camera. The focal point is \par
// modified accordingly. This should be positive.\par
\cf2 void\cf0  vtkCamera::SetDistance(\cf2 double\cf0  d)\par
\{\par
  \cf2 if\cf0  (\cf2 this\cf0 ->Distance == d)\par
    \{\par
    \cf2 return\cf0 ;\par
    \}\par
\par
  \cf2 this\cf0 ->Distance = d; \par
\par
  \cf1 // Distance should be greater than .0002\par
\cf0   \cf2 if\cf0  (\cf2 this\cf0 ->Distance < 0.0002) \par
    \{\par
    \cf2 this\cf0 ->Distance = 0.0002;\par
    vtkDebugMacro(<< " Distance is set to minimum.");\par
    \}\par
  \par
  \cf1 // we want to keep the camera pointing in the same direction\par
\cf0   \cf2 double\cf0  *vec = \cf2 this\cf0 ->DirectionOfProjection;\par
\par
  \cf1 // recalculate FocalPoint\par
\cf0   \cf2 this\cf0 ->FocalPoint[0] = \cf2 this\cf0 ->Position[0] + vec[0]*\cf2 this\cf0 ->Distance;\par
  \cf2 this\cf0 ->FocalPoint[1] = \cf2 this\cf0 ->Position[1] + vec[1]*\cf2 this\cf0 ->Distance;\par
  \cf2 this\cf0 ->FocalPoint[2] = \cf2 this\cf0 ->Position[2] + vec[2]*\cf2 this\cf0 ->Distance;\par
\par
  vtkDebugMacro(<< " Distance set to ( " <<  \cf2 this\cf0 ->Distance << ")");\par
\par
  \cf2 this\cf0 ->ComputeViewTransform();\par
  \cf2 this\cf0 ->ComputeCameraLightTransform();\par
  \cf2 this\cf0 ->Modified();\par
\}  \par
\par
\cf1 //----------------------------------------------------------------------------\par
// This method must be called when the focal point or camera position changes\par
\cf2 void\cf0  vtkCamera::ComputeDistance()\par
\{\par
  \cf2 double\cf0  dx = \cf2 this\cf0 ->FocalPoint[0] - \cf2 this\cf0 ->Position[0];\par
  \cf2 double\cf0  dy = \cf2 this\cf0 ->FocalPoint[1] - \cf2 this\cf0 ->Position[1];\par
  \cf2 double\cf0  dz = \cf2 this\cf0 ->FocalPoint[2] - \cf2 this\cf0 ->Position[2];\par
\par
  \cf2 this\cf0 ->Distance = sqrt(dx*dx + dy*dy + dz*dz);\par
\par
  \cf2 if\cf0  (\cf2 this\cf0 ->Distance < 0.0002) \par
    \{\par
    \cf2 this\cf0 ->Distance = 0.0002;\par
    vtkDebugMacro(<< " Distance is set to minimum.");\par
\par
    \cf2 double\cf0  *vec = \cf2 this\cf0 ->DirectionOfProjection;\par
\par
    \cf1 // recalculate FocalPoint\par
\cf0     \cf2 this\cf0 ->FocalPoint[0] = \cf2 this\cf0 ->Position[0] + vec[0]*\cf2 this\cf0 ->Distance;\par
    \cf2 this\cf0 ->FocalPoint[1] = \cf2 this\cf0 ->Position[1] + vec[1]*\cf2 this\cf0 ->Distance;\par
    \cf2 this\cf0 ->FocalPoint[2] = \cf2 this\cf0 ->Position[2] + vec[2]*\cf2 this\cf0 ->Distance;\par
    \}\par
\par
  \cf2 this\cf0 ->DirectionOfProjection[0] = dx/\cf2 this\cf0 ->Distance;\par
  \cf2 this\cf0 ->DirectionOfProjection[1] = dy/\cf2 this\cf0 ->Distance;\par
  \cf2 this\cf0 ->DirectionOfProjection[2] = dz/\cf2 this\cf0 ->Distance;\par
\par
  \cf2 this\cf0 ->ComputeViewPlaneNormal();\par
\} \par
\par
\cf1 //----------------------------------------------------------------------------\par
// Move the position of the camera along the view plane normal. Moving\par
// towards the focal point (e.g., > 1) is a dolly-in, moving away \par
// from the focal point (e.g., < 1) is a dolly-out.\par
\cf2 void\cf0  vtkCamera::Dolly(\cf2 double\cf0  amount)\par
\{\par
  \cf2 if\cf0  (amount <= 0.0)\par
    \{\par
    \cf2 return\cf0 ;\par
    \}\par
  \par
  \cf1 // dolly moves the camera towards the focus\par
\cf0   \cf2 double\cf0  d = \cf2 this\cf0 ->Distance/amount;\par
  \par
  \cf2 this\cf0 ->SetPosition(\cf2 this\cf0 ->FocalPoint[0] - d*\cf2 this\cf0 ->DirectionOfProjection[0],\par
                    \cf2 this\cf0 ->FocalPoint[1] - d*\cf2 this\cf0 ->DirectionOfProjection[1],\par
                    \cf2 this\cf0 ->FocalPoint[2] - d*\cf2 this\cf0 ->DirectionOfProjection[2]);\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Set the roll angle of the camera about the direction of projection\par
\cf2 void\cf0  vtkCamera::SetRoll(\cf2 double\cf0  roll)\par
\{\par
  \cf1 // roll is a rotation of camera view up about the direction of projection\par
\cf0   vtkDebugMacro(<< " Setting Roll to " << roll << "");\par
\par
  \cf1 // subtract the current roll\par
\cf0   roll -= \cf2 this\cf0 ->GetRoll();\par
\par
  \cf2 if\cf0  (fabs(roll) < 0.00001)\par
    \{\par
    \cf2 return\cf0 ;\par
    \}\par
\par
  \cf2 this\cf0 ->Roll(roll);\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Returns the roll of the camera.\par
\cf2 double\cf0  vtkCamera::GetRoll()\par
\{\par
  \cf2 double\cf0  orientation[3];\par
  \cf2 this\cf0 ->ViewTransform->GetOrientation(orientation);\par
  \cf2 return\cf0  orientation[2];\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Rotate the camera around the view plane normal.\par
\cf2 void\cf0  vtkCamera::Roll(\cf2 double\cf0  angle)\par
\{\par
  \cf2 double\cf0  newViewUp[3];\par
  \cf2 this\cf0 ->Transform->Identity();\par
\par
  \cf1 // rotate ViewUp about the Direction of Projection\par
\cf0   \cf2 this\cf0 ->Transform->RotateWXYZ(angle,\cf2 this\cf0 ->DirectionOfProjection);\par
\par
  \cf1 // okay, okay, TransformPoint shouldn't be used on vectors -- but\par
\cf0   \cf1 // the transform is rotation with no translation so this works fine.\par
\cf0   \cf2 this\cf0 ->Transform->TransformPoint(\cf2 this\cf0 ->ViewUp,newViewUp);\par
  \cf2 this\cf0 ->SetViewUp(newViewUp);\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Rotate the focal point about the view up vector centered at the camera's \par
// position. \par
\cf2 void\cf0  vtkCamera::Yaw(\cf2 double\cf0  angle)\par
\{\par
  \cf2 double\cf0  newFocalPoint[3];\par
  \cf2 double\cf0  *pos = \cf2 this\cf0 ->Position;\par
  \cf2 this\cf0 ->Transform->Identity();\par
\par
  \cf1 // translate the camera to the origin,\par
\cf0   \cf1 // rotate about axis,\par
\cf0   \cf1 // translate back again\par
\cf0   \cf2 this\cf0 ->Transform->Translate(+pos[0],+pos[1],+pos[2]);   \par
  \cf2 this\cf0 ->Transform->RotateWXYZ(angle,\cf2 this\cf0 ->ViewUp);\par
  \cf2 this\cf0 ->Transform->Translate(-pos[0],-pos[1],-pos[2]);\par
  \par
  \cf1 // now transform focal point\par
\cf0   \cf2 this\cf0 ->Transform->TransformPoint(\cf2 this\cf0 ->FocalPoint,newFocalPoint);\par
  \cf2 this\cf0 ->SetFocalPoint(newFocalPoint);\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Rotate the focal point about the cross product of the view up vector \par
// and the negative of the , centered at the camera's position.\par
\cf2 void\cf0  vtkCamera::Pitch(\cf2 double\cf0  angle)\par
\{\par
  \cf2 double\cf0  axis[3], newFocalPoint[3];\par
  \cf2 double\cf0  *pos = \cf2 this\cf0 ->Position;\par
  \cf2 this\cf0 ->Transform->Identity();\par
\par
  \cf1 // the axis is the first row of the view transform matrix\par
\cf0   axis[0] = \cf2 this\cf0 ->ViewTransform->GetMatrix()->GetElement(0,0);\par
  axis[1] = \cf2 this\cf0 ->ViewTransform->GetMatrix()->GetElement(0,1);\par
  axis[2] = \cf2 this\cf0 ->ViewTransform->GetMatrix()->GetElement(0,2);\par
  \par
  \cf1 // translate the camera to the origin,\par
\cf0   \cf1 // rotate about axis,\par
\cf0   \cf1 // translate back again\par
\cf0   \cf2 this\cf0 ->Transform->Translate(+pos[0],+pos[1],+pos[2]);   \par
  \cf2 this\cf0 ->Transform->RotateWXYZ(angle,axis);\par
  \cf2 this\cf0 ->Transform->Translate(-pos[0],-pos[1],-pos[2]);\par
  \par
  \cf1 // now transform focal point\par
\cf0   \cf2 this\cf0 ->Transform->TransformPoint(\cf2 this\cf0 ->FocalPoint,newFocalPoint);\par
  \cf2 this\cf0 ->SetFocalPoint(newFocalPoint);\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Rotate the camera about the view up vector centered at the focal point.\par
\cf2 void\cf0  vtkCamera::Azimuth(\cf2 double\cf0  angle)\par
\{\par
  \cf2 double\cf0  newPosition[3];\par
  \cf2 double\cf0  *fp = \cf2 this\cf0 ->FocalPoint;\par
  \cf2 this\cf0 ->Transform->Identity();\par
\par
  \cf1 // translate the focal point to the origin,\par
\cf0   \cf1 // rotate about view up,\par
\cf0   \cf1 // translate back again  \par
\cf0   \cf2 this\cf0 ->Transform->Translate(+fp[0],+fp[1],+fp[2]);   \par
  \cf2 this\cf0 ->Transform->RotateWXYZ(angle,\cf2 this\cf0 ->ViewUp);\par
  \cf2 this\cf0 ->Transform->Translate(-fp[0],-fp[1],-fp[2]);\par
  \par
  \cf1 // apply the transform to the position\par
\cf0   \cf2 this\cf0 ->Transform->TransformPoint(\cf2 this\cf0 ->Position,newPosition);\par
  \cf2 this\cf0 ->SetPosition(newPosition);\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Rotate the camera about the cross product of the negative of the\par
// direction of projection and the view up vector centered on the focal point.\par
\cf2 void\cf0  vtkCamera::Elevation(\cf2 double\cf0  angle)\par
\{\par
  \cf2 double\cf0  axis[3], newPosition[3];\par
  \cf2 double\cf0  *fp = \cf2 this\cf0 ->FocalPoint;\par
  \cf2 this\cf0 ->Transform->Identity();\par
\par
  \cf1 // snatch the axis from the view transform matrix\par
\cf0   axis[0] = -\cf2 this\cf0 ->ViewTransform->GetMatrix()->GetElement(0,0);\par
  axis[1] = -\cf2 this\cf0 ->ViewTransform->GetMatrix()->GetElement(0,1);\par
  axis[2] = -\cf2 this\cf0 ->ViewTransform->GetMatrix()->GetElement(0,2);\par
  \par
  \cf1 // translate the focal point to the origin,\par
\cf0   \cf1 // rotate about axis,\par
\cf0   \cf1 // translate back again\par
\cf0   \cf2 this\cf0 ->Transform->Translate(+fp[0],+fp[1],+fp[2]);   \par
  \cf2 this\cf0 ->Transform->RotateWXYZ(angle,axis);\par
  \cf2 this\cf0 ->Transform->Translate(-fp[0],-fp[1],-fp[2]);\par
  \par
  \cf1 // now transform position\par
\cf0   \cf2 this\cf0 ->Transform->TransformPoint(\cf2 this\cf0 ->Position,newPosition);\par
  \cf2 this\cf0 ->SetPosition(newPosition);\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Apply Transform to camera\par
\cf2 void\cf0  vtkCamera::ApplyTransform(vtkTransform *t) \{\par
  \par
  \cf2 double\cf0  posOld[4], posNew[4], fpOld[4], fpNew[4], vuOld[4], vuNew[4];\par
\par
  \cf2 this\cf0 ->GetPosition(posOld);\par
  \cf2 this\cf0 ->GetFocalPoint(fpOld);\par
  \cf2 this\cf0 ->GetViewUp(vuOld);\par
\par
  posOld[3] = 1.0;\par
  fpOld[3] = 1.0;\par
  vuOld[3] = 1.0;\par
\par
  vuOld[0] += posOld[0];\par
  vuOld[1] += posOld[1];\par
  vuOld[2] += posOld[2];\par
\par
  t->MultiplyPoint(posOld, posNew);\par
  t->MultiplyPoint(fpOld, fpNew);\par
  t->MultiplyPoint(vuOld, vuNew);\par
\par
  vuNew[0] -= posNew[0];\par
  vuNew[1] -= posNew[1];\par
  vuNew[2] -= posNew[2];\par
\par
  \cf2 this\cf0 ->SetPosition(posNew);\par
  \cf2 this\cf0 ->SetFocalPoint(fpNew);\par
  \cf2 this\cf0 ->SetViewUp(vuNew);\par
  \par
\} \par
\par
\cf1 //----------------------------------------------------------------------------\par
//----------------------------------------------------------------------------\par
// The following methods set up the information that the Renderer needs\par
// to set up the perspective transform.  The transformation matrix is\par
// created using the GetPerspectiveTransformMatrix method.\par
//----------------------------------------------------------------------------\par
//----------------------------------------------------------------------------\par
\par
//----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetParallelProjection(\cf2 int\cf0  flag)\par
\{\par
  \cf2 if\cf0  ( \cf2 this\cf0 ->ParallelProjection != flag ) \par
    \{\par
    \cf2 this\cf0 ->ParallelProjection = flag;\par
    \cf2 this\cf0 ->Modified();\par
    \cf2 this\cf0 ->ViewingRaysModified(); \par
    \} \par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetViewAngle(\cf2 double\cf0  angle)\par
\{\par
  \cf2 double\cf0  min =   0.00000001;\par
  \cf2 double\cf0  max = 179.0;\par
\par
  \cf2 if\cf0  ( \cf2 this\cf0 ->ViewAngle != angle )\par
    \{\par
    \cf2 this\cf0 ->ViewAngle = (angle<min?min:(angle>max?max:angle));\par
    \cf2 this\cf0 ->Modified();\par
    \cf2 this\cf0 ->ViewingRaysModified();\par
    \}\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetUseHorizontalViewAngle(\cf2 int\cf0  flag)\par
\{\par
  \cf2 if\cf0  (flag == \cf2 this\cf0 ->UseHorizontalViewAngle)\par
    \{\par
    \cf2 return\cf0 ;\par
    \}\par
  \cf2 this\cf0 ->UseHorizontalViewAngle = flag;\par
  \cf2 this\cf0 ->Modified();\par
  \cf2 this\cf0 ->ViewingRaysModified();\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetParallelScale(\cf2 double\cf0  scale)\par
\{\par
  \cf2 if\cf0  ( \cf2 this\cf0 ->ParallelScale != scale )\par
    \{\par
    \cf2 this\cf0 ->ParallelScale = scale;\par
    \cf2 this\cf0 ->Modified();\par
    \cf2 this\cf0 ->ViewingRaysModified();\par
    \}\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Change the ViewAngle (for perspective) or the ParallelScale (for parallel)\par
// so that more or less of a scene occupies the viewport.  A value > 1 is a \par
// zoom-in. A value < 1 is a zoom-out.\par
\cf2 void\cf0  vtkCamera::Zoom(\cf2 double\cf0  amount)\par
\{\par
  \cf2 if\cf0  (amount <= 0.0)\par
    \{\par
    \cf2 return\cf0 ;\par
    \}\par
  \par
  \cf2 if\cf0  (\cf2 this\cf0 ->ParallelProjection)\par
    \{\par
    \cf2 this\cf0 ->SetParallelScale(\cf2 this\cf0 ->ParallelScale/amount);\par
    \}\par
  \cf2 else\par
\cf0     \{\par
    \cf2 this\cf0 ->SetViewAngle(\cf2 this\cf0 ->ViewAngle/amount);\par
    \}\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetClippingRange(\cf2 double\cf0  nearz, \cf2 double\cf0  farz)\par
\{\par
  \cf2 double\cf0  thickness;\par
  \par
  \cf1 // check the order\par
\cf0   \cf2 if\cf0  ( nearz > farz )\par
    \{\par
    vtkDebugMacro(<< " Front and back clipping range reversed");\par
    \cf2 double\cf0  temp = nearz;\par
    nearz = farz;\par
    farz = temp;\par
    \}\par
  \par
  \cf1 // front should be greater than 0.0001\par
\cf0   \cf2 if\cf0  (nearz < 0.0001) \par
    \{\par
    farz += 0.0001 - nearz;\par
    nearz = 0.0001;\par
    vtkDebugMacro(<< " Front clipping range is set to minimum.");\par
    \}\par
  \par
  thickness = farz - nearz;\par
  \par
  \cf1 // thickness should be greater than 0.0001\par
\cf0   \cf2 if\cf0  (thickness < 0.0001) \par
    \{\par
    thickness = 0.0001;\par
    vtkDebugMacro(<< " ClippingRange thickness is set to minimum.");\par
    \par
    \cf1 // set back plane\par
\cf0     farz = nearz + thickness;\par
    \}\par
  \par
  \cf2 if\cf0  (nearz == \cf2 this\cf0 ->ClippingRange[0] && \par
      farz == \cf2 this\cf0 ->ClippingRange[1] && \par
      \cf2 this\cf0 ->Thickness == thickness)\par
    \{\par
    \cf2 return\cf0 ;\par
    \}\par
\par
  \cf2 this\cf0 ->ClippingRange[0] = nearz; \par
  \cf2 this\cf0 ->ClippingRange[1] = farz; \par
  \cf2 this\cf0 ->Thickness = thickness;\par
  \par
  vtkDebugMacro(<< " ClippingRange set to ( " <<  \cf2 this\cf0 ->ClippingRange[0] << ", "  << \cf2 this\cf0 ->ClippingRange[1] << ")");\par
\par
  \cf2 this\cf0 ->Modified();\par
\}  \par
\par
\cf1 //----------------------------------------------------------------------------\par
// Set the distance between clipping planes. \par
// This method adjusts the back clipping plane to the specified thickness\par
// behind the front clipping plane \par
\cf2 void\cf0  vtkCamera::SetThickness(\cf2 double\cf0  s)\par
\{\par
  \cf2 if\cf0  (\cf2 this\cf0 ->Thickness == s)\par
    \{\par
    \cf2 return\cf0 ;\par
    \}\par
\par
  \cf2 this\cf0 ->Thickness = s; \par
\par
  \cf1 // thickness should be greater than 0.0001\par
\cf0   \cf2 if\cf0  (\cf2 this\cf0 ->Thickness < 0.0001) \par
    \{\par
    \cf2 this\cf0 ->Thickness = 0.0001;\par
    vtkDebugMacro(<< " ClippingRange thickness is set to minimum.");\par
    \}\par
  \par
  \cf1 // set back plane\par
\cf0   \cf2 this\cf0 ->ClippingRange[1] = \cf2 this\cf0 ->ClippingRange[0] + \cf2 this\cf0 ->Thickness;\par
\par
  vtkDebugMacro(<< " ClippingRange set to ( " <<  \cf2 this\cf0 ->ClippingRange[0] << ", " << \cf2 this\cf0 ->ClippingRange[1] << ")");\par
\par
  \cf2 this\cf0 ->Modified();\par
\}  \par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetWindowCenter(\cf2 double\cf0  x, \cf2 double\cf0  y)\par
\{\par
  \cf2 if\cf0  (\cf2 this\cf0 ->WindowCenter[0] != x || \cf2 this\cf0 ->WindowCenter[1] != y)\par
    \{\par
    \cf2 this\cf0 ->Modified();\par
    \cf2 this\cf0 ->ViewingRaysModified();\par
    \cf2 this\cf0 ->WindowCenter[0] = x;\par
    \cf2 this\cf0 ->WindowCenter[1] = y;\par
    \}\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetObliqueAngles(\cf2 double\cf0  alpha, \cf2 double\cf0  beta)\par
\{\par
  alpha *= vtkMath::DoubleDegreesToRadians();\par
  beta *= vtkMath::DoubleDegreesToRadians();\par
\par
  \cf2 double\cf0  cotbeta = cos(beta) / sin(beta);\par
  \cf2 double\cf0  dxdz = cos(alpha) * cotbeta;\par
  \cf2 double\cf0  dydz = sin(alpha) * cotbeta;\par
\par
  \cf2 this\cf0 ->SetViewShear(dxdz, dydz, 1.0);\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Set the shear transform of the viewing frustum.  Parameters are\par
// dx/dz, dy/dz, and center.  center is a factor that describes where\par
// to shear around. The distance dshear from the camera where\par
// no shear occurs is given by (dshear = center * FocalDistance).\par
//\par
\cf2 void\cf0  vtkCamera::SetViewShear(\cf2 double\cf0  dxdz, \cf2 double\cf0  dydz, \cf2 double\cf0  center)\par
\{\par
  \cf2 if\cf0 (dxdz != \cf2 this\cf0 ->ViewShear[0] || \par
     dydz != \cf2 this\cf0 ->ViewShear[1] ||\par
     center != \cf2 this\cf0 ->ViewShear[2])\par
    \{\par
      \cf2 this\cf0 ->Modified();\par
      \cf2 this\cf0 ->ViewingRaysModified();\par
\par
      \cf2 this\cf0 ->ViewShear[0] = dxdz;\par
      \cf2 this\cf0 ->ViewShear[1] = dydz;\par
      \cf2 this\cf0 ->ViewShear[2] = center;\par
      \par
      \cf2 this\cf0 ->ComputeViewPlaneNormal();\par
    \}\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Compute the perspective transform matrix. This is used in converting \par
// between view and world coordinates.\par
\cf2 void\cf0  vtkCamera::SetViewShear(\cf2 double\cf0  d[3]) \par
\{\par
  \cf2 this\cf0 ->SetViewShear(d[0], d[1], d[2]);\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Compute the perspective transform matrix. This is used in converting \par
// between view and world coordinates.\par
\cf2 void\cf0  vtkCamera::ComputePerspectiveTransform(\cf2 double\cf0  aspect, \par
                                            \cf2 double\cf0  nearz, \cf2 double\cf0  farz)\par
\{\par
  \cf2 this\cf0 ->PerspectiveTransform->Identity();\par
\par
  \cf1 // apply user defined transform last if there is one \par
\cf0   \cf2 if\cf0  (\cf2 this\cf0 ->UserTransform)\par
    \{\par
    \cf2 this\cf0 ->PerspectiveTransform->Concatenate(\cf2 this\cf0 ->UserTransform->GetMatrix());\par
    \}\par
\par
  \cf1 // adjust Z-buffer range\par
\cf0   \cf2 this\cf0 ->PerspectiveTransform->AdjustZBuffer(-1, +1, nearz, farz);\par
\par
  \cf2 if\cf0  (\cf2 this\cf0 ->ParallelProjection)\par
    \{\par
    \cf1 // set up a rectangular parallelipiped\par
\par
\cf0     \cf2 double\cf0  width = \cf2 this\cf0 ->ParallelScale*aspect;\par
    \cf2 double\cf0  height = \cf2 this\cf0 ->ParallelScale;\par
\par
    \cf2 double\cf0  xmin = (\cf2 this\cf0 ->WindowCenter[0]-1.0)*width;\par
    \cf2 double\cf0  xmax = (\cf2 this\cf0 ->WindowCenter[0]+1.0)*width;\par
    \cf2 double\cf0  ymin = (\cf2 this\cf0 ->WindowCenter[1]-1.0)*height;\par
    \cf2 double\cf0  ymax = (\cf2 this\cf0 ->WindowCenter[1]+1.0)*height;\par
\par
\tab\cf1 // void  Ortho (double xmin, double xmax, double ymin, double ymax, double znear, double zfar) \par
\cf0\tab\cf1 //\par
\cf0\tab\cf1 // Create an orthogonal projection matrix and concatenate it by the current transformation.\par
\cf0\tab\cf1 // The matrix maps [xmin,xmax], [ymin,ymax], [-znear,-zfar] to [-1,+1], [-1,+1], [+1,-1]. \par
\cf0\tab\cf1 //\par
\cf0     \cf2 this\cf0 ->PerspectiveTransform->Ortho(xmin,xmax,ymin,ymax,\par
                                      \cf2 this\cf0 ->ClippingRange[0],\par
                                      \cf2 this\cf0 ->ClippingRange[1]);\par
    \}\par
  \cf2 else\par
\cf0     \{\par
    \cf1 // set up a perspective frustum\par
\par
\cf0     \cf2 double\cf0  tmp = tan(\cf2 this\cf0 ->ViewAngle*vtkMath::DoubleDegreesToRadians()/2);\par
    \cf2 double\cf0  width;\par
    \cf2 double\cf0  height;\par
    \cf2 if\cf0  (\cf2 this\cf0 ->UseHorizontalViewAngle)\par
      \{\par
      width = \cf2 this\cf0 ->ClippingRange[0]*tmp;\par
      height = \cf2 this\cf0 ->ClippingRange[0]*tmp/aspect;\par
      \}\par
    \cf2 else\par
\cf0       \{\par
      width = \cf2 this\cf0 ->ClippingRange[0]*tmp*aspect;\par
      height = \cf2 this\cf0 ->ClippingRange[0]*tmp;\par
      \}\par
\par
    \cf2 double\cf0  xmin = (\cf2 this\cf0 ->WindowCenter[0]-1.0)*width;\par
    \cf2 double\cf0  xmax = (\cf2 this\cf0 ->WindowCenter[0]+1.0)*width;\par
    \cf2 double\cf0  ymin = (\cf2 this\cf0 ->WindowCenter[1]-1.0)*height;\par
    \cf2 double\cf0  ymax = (\cf2 this\cf0 ->WindowCenter[1]+1.0)*height;\par
\par
\tab\cf1 // void  Frustum (double xmin, double xmax, double ymin, double ymax, double znear, double zfar) \par
\cf0\tab\cf1 //\par
\cf0\tab\cf1 // Create an perspective projection matrix and concatenate it by the current transformation. \par
\cf0\tab\cf1 // The matrix maps a frustum with a back plane at -zfar and a front plane at -znear with\par
\cf0\tab\cf1 // extent [xmin,xmax],[ymin,ymax] to [-1,+1], [-1,+1], [+1,-1].\par
\cf0\tab\cf1 //\par
\cf0     \cf2 this\cf0 ->PerspectiveTransform->Frustum(xmin, xmax, ymin, ymax,\par
                                        \cf2 this\cf0 ->ClippingRange[0],\par
                                        \cf2 this\cf0 ->ClippingRange[1]);\par
    \}\par
\par
  \cf1 //MODIFIED BY VALERIA\par
\cf0   \cf2 if\cf0  (\cf2 this\cf0 ->Stereo)\par
    \{\par
\tab\par
    \cf1 // set up a shear for stereo views\par
\cf0     \cf2 if\cf0  (\cf2 this\cf0 ->LeftEye)\par
      \{\par
\tab   \cf1 // void  Stereo (double angle, double focaldistance)\par
\cf0\tab   \cf1 //\par
\cf0\tab   \cf1 // Create a stereo shear matrix and concatenate it with the current transformation.\par
\cf0\tab   \cf1 // This can be applied in conjunction with either a perspective transformation\par
\cf0\tab   \cf1 // (via Frustum or Projection) or an orthographic projection. You must specify the \par
\cf0\tab   \cf1 // distance from the camera plane to the focal plane, and the angle between the distance\par
\cf0\tab   \cf1 // vector and the eye. The angle should be negative for the left eye, and positive for\par
\cf0\tab   \cf1 // the right. This method works via Oblique.\par
\cf0\tab   \cf1 //\par
\cf0       \cf2 this\cf0 ->PerspectiveTransform->Stereo(-\cf2 this\cf0 ->EyeAngle/2,\par
\tab\tab\tab\tab\tab\tab\tab\tab\tab\tab   \cf2 this\cf0 ->Distance-600);\par
\tab\tab\tab\tab\tab\tab\tab\tab\tab\tab   \cf1 //this->Distance);\par
\cf0       \}\par
    \cf2 else\par
\cf0       \{\par
      \cf2 this\cf0 ->PerspectiveTransform->Stereo(\cf2 this\cf0 ->EyeAngle/2,\par
\tab\tab\tab\tab\tab\tab\tab\tab\tab\tab  \cf2 this\cf0 ->Distance-600);\par
\tab\tab\tab\tab\tab\tab\tab\tab\tab\tab  \cf1 //this->Distance);                        \par
\cf0       \}\par
    \}\par
\par
  \cf2 if\cf0  (\cf2 this\cf0 ->ViewShear[0] != 0.0 || \cf2 this\cf0 ->ViewShear[1] != 0.0) \par
    \{\par
\tab\cf1 // void  Shear (double dxdz, double dydz, double zplane)\par
\cf0\tab\cf1 //\par
\cf0\tab\cf1 // Create a shear transformation about a plane at distance z from the camera. The values\par
\cf0\tab\cf1 // dxdz (i.e. dx/dz) and dydz specify the amount of shear in the x and y directions. \par
\cf0\tab\cf1 // The 'zplane' specifies the distance from the camera to the plane at which the shear\par
\cf0\tab\cf1 // causes zero displacement. Generally you want this plane to be the focal plane.\par
\cf0\tab\cf1 // This transformation can be used in combination with Ortho to create an oblique projection.\par
\cf0\tab\cf1 // It can also be used in combination with Perspective to provide correct stereo views when\par
\cf0\tab\cf1 // the eye is at arbitrary but known positions relative to the center of a flat viewing screen.\par
\cf0     \cf1 //\par
\cf0\tab\cf2 this\cf0 ->PerspectiveTransform->Shear(\cf2 this\cf0 ->ViewShear[0],\par
                                      \cf2 this\cf0 ->ViewShear[1],\par
\tab\tab\tab\tab\tab\tab\tab\tab\tab   \cf2 this\cf0 ->ViewShear[2]*\cf2 this\cf0 ->Distance-600);\par
                                      \cf1 //this->ViewShear[2]*this->Distance);\par
\cf0     \}\par
  \par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Return the perspective transform matrix. See ComputePerspectiveTransform.\par
\cf0 vtkMatrix4x4 *vtkCamera::GetPerspectiveTransformMatrix(\cf2 double\cf0  aspect,\par
                                                       \cf2 double\cf0  nearz,\par
                                                       \cf2 double\cf0  farz)\par
\{\par
  \cf2 this\cf0 ->ComputePerspectiveTransform(aspect, nearz, farz);\par
  \par
  \cf1 // return the transform \par
\cf0   \cf2 return\cf0  \cf2 this\cf0 ->PerspectiveTransform->GetMatrix();\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Return the perspective transform matrix. See ComputePerspectiveTransform.\par
\cf0 vtkMatrix4x4 *vtkCamera::GetCompositePerspectiveTransformMatrix(\cf2 double\cf0  aspect,\par
                                                                \cf2 double\cf0  nearz,\par
                                                                \cf2 double\cf0  farz)\par
\{\par
  \cf1 // turn off stereo, the CompositePerspectiveTransformMatrix is used for\par
\cf0   \cf1 // picking, not for rendering.\par
\cf0   \cf2 int\cf0  stereo = \cf2 this\cf0 ->Stereo;\par
  \cf2 this\cf0 ->Stereo = 0;\par
\par
  \cf2 this\cf0 ->Transform->Identity();\par
  \cf2 this\cf0 ->Transform->Concatenate(\cf2 this\cf0 ->GetPerspectiveTransformMatrix(aspect,\par
                                                                   nearz,\par
                                                                   farz));\par
  \cf2 this\cf0 ->Transform->Concatenate(\cf2 this\cf0 ->GetViewTransformMatrix());\par
\par
  \cf2 this\cf0 ->Stereo = stereo;\par
  \par
  \cf1 // return the transform \par
\cf0   \cf2 return\cf0  \cf2 this\cf0 ->Transform->GetMatrix();\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Return the attached light transform matrix.\par
\cf0 vtkMatrix4x4 *vtkCamera::GetCameraLightTransformMatrix()\par
\{\par
  \cf1 // return the transform \par
\cf0   \cf2 return\cf0  \cf2 this\cf0 ->CameraLightTransform->GetMatrix();\par
\}\par
\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::ComputeViewPlaneNormal()\par
\{\par
  \cf2 if\cf0  (\cf2 this\cf0 ->ViewShear[0] != 0.0 || \cf2 this\cf0 ->ViewShear[1] != 0.0)\par
    \{\par
    \cf1 // set the VPN in camera coordinates\par
\cf0     \cf2 this\cf0 ->ViewPlaneNormal[0] = \cf2 this\cf0 ->ViewShear[0];\par
    \cf2 this\cf0 ->ViewPlaneNormal[1] = \cf2 this\cf0 ->ViewShear[1];\par
    \cf2 this\cf0 ->ViewPlaneNormal[2] = 1.0;\par
    \cf1 // transform the VPN to world coordinates using inverse of view transform\par
\cf0     \cf2 this\cf0 ->ViewTransform->GetLinearInverse()->TransformNormal(\par
                                              \cf2 this\cf0 ->ViewPlaneNormal,\par
                                              \cf2 this\cf0 ->ViewPlaneNormal);\par
    \}\par
  \cf2 else\par
\cf0     \{\par
    \cf1 // VPN is -DOP\par
\cf0     \cf2 this\cf0 ->ViewPlaneNormal[0] = -\cf2 this\cf0 ->DirectionOfProjection[0];\par
    \cf2 this\cf0 ->ViewPlaneNormal[1] = -\cf2 this\cf0 ->DirectionOfProjection[1];\par
    \cf2 this\cf0 ->ViewPlaneNormal[2] = -\cf2 this\cf0 ->DirectionOfProjection[2];\par
    \}\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::SetViewPlaneNormal(\cf2 double\cf0  vtkNotUsed(x), \par
                                   \cf2 double\cf0  vtkNotUsed(y),\par
                                   \cf2 double\cf0  vtkNotUsed(z))\par
\{\par
  vtkWarningMacro(<< "SetViewPlaneNormal:  This method is deprecated, the view plane normal is calculated automatically.");\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
// Return the 6 planes (Ax + By + Cz + D = 0) that bound\par
// the view frustum. \par
\cf2 void\cf0  vtkCamera::GetFrustumPlanes(\cf2 double\cf0  aspect, \cf2 double\cf0  planes[24])\par
\{\par
  \cf2 int\cf0  i;\par
  \cf2 double\cf0  f, normals[6][4], matrix[4][4];\par
\par
  \cf1 // set up the normals\par
\cf0   \cf2 for\cf0  (i = 0; i < 6; i++)\par
    \{\par
    normals[i][0] = 0.0;\par
    normals[i][1] = 0.0;\par
    normals[i][2] = 0.0;\par
    normals[i][3] = 1.0;\par
    \cf1 // if i is even set to -1, if odd set to +1 \par
\cf0     normals[i][i/2] = 1 - (i%2)*2;\par
    \}\par
\par
  \cf1 // get the composite perspective matrix\par
\cf0   vtkMatrix4x4::DeepCopy(\par
    *matrix, \par
    \cf2 this\cf0 ->GetCompositePerspectiveTransformMatrix(aspect,-1,+1));\par
  \par
  \cf1 // transpose the matrix for use with normals\par
\cf0   vtkMatrix4x4::Transpose(*matrix,*matrix);\par
  \par
  \cf1 // transform the normals to world coordinates\par
\cf0   \cf2 for\cf0  (i = 0; i < 6; i++)\par
    \{\par
    vtkMatrix4x4::MultiplyPoint(*matrix,normals[i],normals[i]);\par
\par
    f = 1.0/sqrt(normals[i][0]*normals[i][0] +\par
                 normals[i][1]*normals[i][1] +\par
                 normals[i][2]*normals[i][2]);\par
    \par
    planes[4*i + 0] = normals[i][0]*f;\par
    planes[4*i + 1] = normals[i][1]*f;\par
    planes[4*i + 2] = normals[i][2]*f;\par
    planes[4*i + 3] = normals[i][3]*f;\par
    \}\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 unsigned\cf0  \cf2 long\cf0  \cf2 int\cf0  vtkCamera::GetViewingRaysMTime()\par
\{\par
  \cf2 return\cf0  \cf2 this\cf0 ->ViewingRaysMTime.GetMTime();\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::ViewingRaysModified()\par
\{\par
  \cf2 this\cf0 ->ViewingRaysMTime.Modified();\par
\}\par
\par
\cf1 //----------------------------------------------------------------------------\par
\cf2 void\cf0  vtkCamera::PrintSelf(ostream& os, vtkIndent indent)\par
\{\par
  \cf2 this\cf0 ->Superclass::PrintSelf(os,indent);\par
\par
  os << indent << "ClippingRange: (" << \cf2 this\cf0 ->ClippingRange[0] << ", " \par
     << \cf2 this\cf0 ->ClippingRange[1] << ")\\n";\par
  os << indent << "DirectionOfProjection: (" << \cf2 this\cf0 ->DirectionOfProjection[0]\par
     << ", " << \cf2 this\cf0 ->DirectionOfProjection[1] \par
     << ", " << \cf2 this\cf0 ->DirectionOfProjection[2] << ")\\n";\par
  os << indent << "Distance: " << \cf2 this\cf0 ->Distance << "\\n";\par
  os << indent << "EyeAngle: " << \cf2 this\cf0 ->EyeAngle << "\\n";\par
  os << indent << "FocalDisk: " << \cf2 this\cf0 ->FocalDisk << "\\n";\par
  os << indent << "FocalPoint: (" << \cf2 this\cf0 ->FocalPoint[0] << ", " \par
     << \cf2 this\cf0 ->FocalPoint[1] << ", " << \cf2 this\cf0 ->FocalPoint[2] << ")\\n";\par
  os << indent << "ViewShear: (" << \cf2 this\cf0 ->ViewShear[0]\par
     << ", " << \cf2 this\cf0 ->ViewShear[1] \par
     << ", " << \cf2 this\cf0 ->ViewShear[2] << ")\\n";\par
  os << indent << "ParallelProjection: " << \par
    (\cf2 this\cf0 ->ParallelProjection ? "On\\n" : "Off\\n");\par
  os << indent << "ParallelScale: " << \cf2 this\cf0 ->ParallelScale << "\\n";\par
  os << indent << "Position: (" << \cf2 this\cf0 ->Position[0] << ", " \par
     << \cf2 this\cf0 ->Position[1] << ", " << \cf2 this\cf0 ->Position[2] << ")\\n";\par
  os << indent << "Stereo: " << (\cf2 this\cf0 ->Stereo ? "On\\n" : "Off\\n");\par
  os << indent << "Thickness: " << \cf2 this\cf0 ->Thickness << "\\n";\par
  os << indent << "ViewAngle: " << \cf2 this\cf0 ->ViewAngle << "\\n";\par
  os << indent << "UseHorizontalViewAngle: " << \cf2 this\cf0 ->UseHorizontalViewAngle << "\\n";\par
  os << indent << "UserTransform: ";\par
  \cf2 if\cf0  (\cf2 this\cf0 ->UserTransform)\par
    \{\par
    os << \cf2 this\cf0 ->UserTransform << "\\n"; \par
    \}\par
  \cf2 else\par
\cf0     \{\par
    os << "(none)\\n";\par
    \}\par
  os << indent << "ViewPlaneNormal: (" << \cf2 this\cf0 ->ViewPlaneNormal[0]\par
     << ", " << \cf2 this\cf0 ->ViewPlaneNormal[1] \par
     << ", " << \cf2 this\cf0 ->ViewPlaneNormal[2] << ")\\n";\par
  os << indent << "ViewUp: (" << \cf2 this\cf0 ->ViewUp[0] << ", " \par
     << \cf2 this\cf0 ->ViewUp[1] << ", " << \cf2 this\cf0 ->ViewUp[2] << ")\\n";\par
  os << indent << "WindowCenter: (" << \cf2 this\cf0 ->WindowCenter[0] << ", " \par
     << \cf2 this\cf0 ->WindowCenter[1] << ")\\n";\par
\}\par
\par
vtkMatrix4x4 *vtkCamera::GetViewTransformMatrix() \par
\{ \cf2 return\cf0  \cf2 this\cf0 ->ViewTransform->GetMatrix(); \}\par
\par
\cf2 double\cf0  *vtkCamera::GetOrientation() \par
\{ \cf2 return\cf0  \cf2 this\cf0 ->ViewTransform->GetOrientation(); \};\par
\par
\cf2 double\cf0  *vtkCamera::GetOrientationWXYZ() \par
\{ \cf2 return\cf0  \cf2 this\cf0 ->ViewTransform->GetOrientationWXYZ(); \};\par
\f1\par
}
 