00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00058 #ifndef __vtkCamera_h
00059 #define __vtkCamera_h
00060
00061 #include "vtkObject.h"
00062 #include "vtkTransform.h"
00063 #include "vtkPerspectiveTransform.h"
00064
00065 class vtkRenderer;
00066
00067 class VTK_EXPORT vtkCamera : public vtkObject
00068 {
00069 public:
00070 void PrintSelf(ostream& os, vtkIndent indent);
00071 vtkTypeMacro(vtkCamera,vtkObject);
00072
00076 static vtkCamera *New();
00077
00080 void SetPosition(double x, double y, double z);
00081 void SetPosition(const double a[3]) {
00082 this->SetPosition(a[0], a[1], a[2]); };
00083 void SetPosition(const float a[3]) {
00084 this->SetPosition(a[0], a[1], a[2]); };
00085 vtkGetVector3Macro(Position,double);
00086 void GetPosition(float a[3]) {
00087 double tmp[3]; this->GetPosition(tmp);
00088 a[0] = tmp[0]; a[1] = tmp[1]; a[2] = tmp[2]; };
00089
00092 void SetFocalPoint(double x, double y, double z);
00093 void SetFocalPoint(const double a[3]) {
00094 this->SetFocalPoint(a[0], a[1], a[2]);};
00095 void SetFocalPoint(const float a[3]) {
00096 this->SetFocalPoint(a[0], a[1], a[2]);};
00097 vtkGetVector3Macro(FocalPoint,double);
00098 void GetFocalPoint(float a[3]) {
00099 double tmp[3]; this->GetFocalPoint(tmp);
00100 a[0] = tmp[0]; a[1] = tmp[1]; a[2] = tmp[2]; };
00101
00104 void SetViewUp(double vx, double vy, double vz);
00105 void SetViewUp(const double a[3]) {
00106 this->SetViewUp(a[0], a[1], a[2]); }
00107 void SetViewUp(const float a[3]) {
00108 this->SetViewUp(a[0], a[1], a[2]); }
00109 vtkGetVector3Macro(ViewUp,double);
00110 void GetViewUp(float a[3]) {
00111 double tmp[3]; this->GetViewUp(tmp);
00112 a[0] = tmp[0]; a[1] = tmp[1]; a[2] = tmp[2]; };
00113
00117 void OrthogonalizeViewUp();
00118
00121 void SetDistance(double);
00122 vtkGetMacro(Distance,double);
00123
00127 vtkGetVector3Macro(DirectionOfProjection,double);
00128 void GetDirectionOfProjection(float a[3]) {
00129 double tmp[3]; this->GetDirectionOfProjection(tmp);
00130 a[0] = tmp[0]; a[1] = tmp[1]; a[2] = tmp[2]; };
00131
00135 void Dolly(double distance);
00136
00138 void SetRoll(double angle);
00139 double GetRoll();
00140
00142 void Roll(double angle);
00143
00147 void Azimuth(double angle);
00148
00152 void Yaw(double angle);
00153
00156 void Elevation(double angle);
00157
00160 void Pitch(double angle);
00161
00165 void SetParallelProjection(int flag);
00166 vtkGetMacro(ParallelProjection,int);
00167 vtkBooleanMacro(ParallelProjection,int);
00168
00176 void SetViewAngle(double angle);
00177 vtkGetMacro(ViewAngle,double);
00178
00182 void SetParallelScale(double scale);
00183 vtkGetMacro(ParallelScale,double);
00184
00189 void Zoom(double factor);
00190
00198 void SetClippingRange(double near, double far);
00199 void SetClippingRange(const double a[2]) {
00200 this->SetClippingRange(a[0], a[1]); };
00201 void SetClippingRange(const float a[2]) {
00202 this->SetClippingRange(a[0], a[1]); };
00203 vtkGetVector2Macro(ClippingRange,double);
00204 void GetClippingRange(float a[2]) {
00205 double tmp[2]; this->GetClippingRange(tmp);
00206 a[0] = tmp[0]; a[1] = tmp[1]; };
00207
00211 void SetThickness(double);
00212 vtkGetMacro(Thickness,double);
00213
00219 void SetWindowCenter(double x, double y);
00220 vtkGetVector2Macro(WindowCenter,double);
00221
00230 void SetObliqueAngles(double alpha, double beta);
00231 vtkGetVector2Macro(ObliqueAngles,double);
00232
00236 vtkGetVector3Macro(ViewPlaneNormal,double);
00237 void GetViewPlaneNormal(float a[3]) {
00238 double tmp[3]; this->GetViewPlaneNormal(tmp);
00239 a[0] = tmp[0]; a[1] = tmp[1]; a[2] = tmp[2]; };
00240
00243 vtkSetMacro(EyeAngle,double);
00244 vtkGetMacro(EyeAngle,double);
00245
00250 vtkSetMacro(FocalDisk,double);
00251 vtkGetMacro(FocalDisk,double);
00252
00254 vtkMatrix4x4 *GetViewTransformMatrix() {
00255 return this->ViewTransform->GetMatrix(); };
00256
00262 vtkMatrix4x4 *GetPerspectiveTransformMatrix(double aspect,
00263 double nearz,
00264 double farz);
00265
00272 vtkMatrix4x4 *GetCompositePerspectiveTransformMatrix(double aspect,
00273 double nearz,
00274 double farz);
00275
00279 virtual void Render(vtkRenderer *) {};
00280
00283 unsigned long GetViewingRaysMTime();
00284
00287 void ViewingRaysModified();
00288
00294 void GetFrustumPlanes(float aspect, float planes[24]);
00295
00297 float *GetOrientation() {
00298 return this->ViewTransform->GetOrientation(); };
00299 float *GetOrientationWXYZ() {
00300 return this->ViewTransform->GetOrientationWXYZ(); };
00301
00305 void SetViewPlaneNormal(double x, double y, double z);
00306 void SetViewPlaneNormal(const double a[3]) {
00307 this->SetViewPlaneNormal(a[0], a[1], a[2]); };
00308 void SetViewPlaneNormal(const float a[3]) {
00309 this->SetViewPlaneNormal(a[0], a[1], a[2]); };
00310
00313 void ComputeViewPlaneNormal();
00314
00318 vtkMatrix4x4 *GetCameraLightTransformMatrix();
00319
00320 #ifndef VTK_REMOVE_LEGACY_CODE
00321
00322 vtkMatrix4x4 &GetViewTransform()
00323 {VTK_LEGACY_METHOD(GetViewTransformMatrix,"3.2"); return *this->GetViewTransformMatrix();}
00324 vtkMatrix4x4 &GetPerspectiveTransform(double aspect,double nearz,double farz)
00325 {VTK_LEGACY_METHOD(GetPerspectiveTransformMatrix,"3.2"); return *this->GetPerspectiveTransformMatrix(aspect, nearz, farz);}
00326 vtkMatrix4x4 &GetCompositePerspectiveTransform(double aspect, double nearz, double farz)
00327 {VTK_LEGACY_METHOD(GetCompositePerspectiveTransformMatrix,"3.2"); return *this->GetCompositePerspectiveTransformMatrix(aspect,nearz,farz);}
00328 #endif
00329
00330 protected:
00331 vtkCamera();
00332 ~vtkCamera();
00333 vtkCamera(const vtkCamera&) {};
00334 void operator=(const vtkCamera&) {};
00335
00337 void ComputeDistance();
00338 void ComputeViewTransform();
00339 void ComputePerspectiveTransform(double aspect, double nearz, double farz);
00340 void ComputeCompositePerspectiveTransform(double aspect,
00341 double nearz, double farz);
00342 void ComputeCameraLightTransform();
00343
00344
00345
00346 double WindowCenter[2];
00347 double ObliqueAngles[2];
00348 double FocalPoint[3];
00349 double Position[3];
00350 double ViewUp[3];
00351 double ViewAngle;
00352 double ClippingRange[2];
00353 double EyeAngle;
00354 int ParallelProjection;
00355 double ParallelScale;
00356 int Stereo;
00357 int LeftEye;
00358 double Thickness;
00359 double Distance;
00360 double DirectionOfProjection[3];
00361 double ViewPlaneNormal[3];
00362
00363 vtkTransform *ViewTransform;
00364 vtkPerspectiveTransform *PerspectiveTransform;
00365 vtkPerspectiveTransform *Transform;
00366 vtkTransform *CameraLightTransform;
00367
00368 double FocalDisk;
00369
00370
00371
00372
00373 vtkTimeStamp ViewingRaysMTime;
00374 };
00375
00376 #endif
00377