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
00062 #ifndef __vtkCamera_h
00063 #define __vtkCamera_h
00064
00065 #include "vtkObject.h"
00066 #include "vtkTransform.h"
00067 #include "vtkPerspectiveTransform.h"
00068
00069 class vtkRenderer;
00070
00071 class VTK_RENDERING_EXPORT vtkCamera : public vtkObject
00072 {
00073 public:
00074 void PrintSelf(ostream& os, vtkIndent indent);
00075 vtkTypeMacro(vtkCamera,vtkObject);
00076
00080 static vtkCamera *New();
00081
00083
00085 void SetPosition(double x, double y, double z);
00086 void SetPosition(const double a[3]) {
00087 this->SetPosition(a[0], a[1], a[2]); };
00088 void SetPosition(const float a[3]) {
00089 this->SetPosition(a[0], a[1], a[2]); };
00090 vtkGetVector3Macro(Position,double);
00091 void GetPosition(float a[3]) {
00092 double tmp[3]; this->GetPosition(tmp);
00093 a[0] = tmp[0]; a[1] = tmp[1]; a[2] = tmp[2]; };
00095
00097
00099 void SetFocalPoint(double x, double y, double z);
00100 void SetFocalPoint(const double a[3]) {
00101 this->SetFocalPoint(a[0], a[1], a[2]);};
00102 void SetFocalPoint(const float a[3]) {
00103 this->SetFocalPoint(a[0], a[1], a[2]);};
00104 vtkGetVector3Macro(FocalPoint,double);
00105 void GetFocalPoint(float a[3]) {
00106 double tmp[3]; this->GetFocalPoint(tmp);
00107 a[0] = tmp[0]; a[1] = tmp[1]; a[2] = tmp[2]; };
00109
00111
00113 void SetViewUp(double vx, double vy, double vz);
00114 void SetViewUp(const double a[3]) {
00115 this->SetViewUp(a[0], a[1], a[2]); }
00116 void SetViewUp(const float a[3]) {
00117 this->SetViewUp(a[0], a[1], a[2]); }
00118 vtkGetVector3Macro(ViewUp,double);
00119 void GetViewUp(float a[3]) {
00120 double tmp[3]; this->GetViewUp(tmp);
00121 a[0] = tmp[0]; a[1] = tmp[1]; a[2] = tmp[2]; };
00123
00127 void OrthogonalizeViewUp();
00128
00130
00132 void SetDistance(double);
00133 vtkGetMacro(Distance,double);
00135
00137
00140 vtkGetVector3Macro(DirectionOfProjection,double);
00141 void GetDirectionOfProjection(float a[3]) {
00142 double tmp[3]; this->GetDirectionOfProjection(tmp);
00143 a[0] = tmp[0]; a[1] = tmp[1]; a[2] = tmp[2]; };
00145
00149 void Dolly(double distance);
00150
00152
00153 void SetRoll(double angle);
00154 double GetRoll();
00156
00158 void Roll(double angle);
00159
00163 void Azimuth(double angle);
00164
00168 void Yaw(double angle);
00169
00172 void Elevation(double angle);
00173
00176 void Pitch(double angle);
00177
00179
00182 void SetParallelProjection(int flag);
00183 vtkGetMacro(ParallelProjection,int);
00184 vtkBooleanMacro(ParallelProjection,int);
00186
00188
00195 void SetViewAngle(double angle);
00196 vtkGetMacro(ViewAngle,double);
00198
00200
00205 void SetParallelScale(double scale);
00206 vtkGetMacro(ParallelScale,double);
00208
00213 void Zoom(double factor);
00214
00216
00223 void SetClippingRange(double near, double far);
00224 void SetClippingRange(const double a[2]) {
00225 this->SetClippingRange(a[0], a[1]); };
00226 void SetClippingRange(const float a[2]) {
00227 this->SetClippingRange(a[0], a[1]); };
00228 vtkGetVector2Macro(ClippingRange,double);
00229 void GetClippingRange(float a[2]) {
00230 double tmp[2]; this->GetClippingRange(tmp);
00231 a[0] = tmp[0]; a[1] = tmp[1]; };
00233
00235
00238 void SetThickness(double);
00239 vtkGetMacro(Thickness,double);
00241
00243
00248 void SetWindowCenter(double x, double y);
00249 vtkGetVector2Macro(WindowCenter,double);
00251
00260 void SetObliqueAngles(double alpha, double beta);
00261
00263
00266 vtkGetVector3Macro(ViewPlaneNormal,double);
00267 void GetViewPlaneNormal(float a[3]) {
00268 double tmp[3]; this->GetViewPlaneNormal(tmp);
00269 a[0] = tmp[0]; a[1] = tmp[1]; a[2] = tmp[2]; };
00271
00272
00274
00278 void SetViewShear(double dxdz, double dydz, double center);
00279 void SetViewShear(double d[3]);
00280 vtkGetVector3Macro(ViewShear, double);
00282
00284
00286 vtkSetMacro(EyeAngle,double);
00287 vtkGetMacro(EyeAngle,double);
00289
00291
00295 vtkSetMacro(FocalDisk,double);
00296 vtkGetMacro(FocalDisk,double);
00298
00300
00301 vtkMatrix4x4 *GetViewTransformMatrix() {
00302 return this->ViewTransform->GetMatrix(); };
00304
00306
00311 vtkMatrix4x4 *GetPerspectiveTransformMatrix(double aspect,
00312 double nearz,
00313 double farz);
00315
00317
00323 vtkMatrix4x4 *GetCompositePerspectiveTransformMatrix(double aspect,
00324 double nearz,
00325 double farz);
00327
00331 virtual void Render(vtkRenderer *) {};
00332
00335 unsigned long GetViewingRaysMTime();
00336
00339 void ViewingRaysModified();
00340
00346 void GetFrustumPlanes(float aspect, float planes[24]);
00347
00349
00350 float *GetOrientation() {
00351 return this->ViewTransform->GetOrientation(); };
00352 float *GetOrientationWXYZ() {
00353 return this->ViewTransform->GetOrientationWXYZ(); };
00355
00357
00360 void SetViewPlaneNormal(double x, double y, double z);
00361 void SetViewPlaneNormal(const double a[3]) {
00362 this->SetViewPlaneNormal(a[0], a[1], a[2]); };
00363 void SetViewPlaneNormal(const float a[3]) {
00364 this->SetViewPlaneNormal(a[0], a[1], a[2]); };
00366
00369 void ComputeViewPlaneNormal();
00370
00374 vtkMatrix4x4 *GetCameraLightTransformMatrix();
00375
00377 virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
00378
00379 #ifndef VTK_REMOVE_LEGACY_CODE
00380
00381
00382 vtkMatrix4x4 &GetViewTransform()
00383 {VTK_LEGACY_METHOD(GetViewTransformMatrix,"3.2"); return *this->GetViewTransformMatrix();}
00384 vtkMatrix4x4 &GetPerspectiveTransform(double aspect,double nearz,double farz)
00385 {VTK_LEGACY_METHOD(GetPerspectiveTransformMatrix,"3.2"); return *this->GetPerspectiveTransformMatrix(aspect, nearz, farz);}
00386 vtkMatrix4x4 &GetCompositePerspectiveTransform(double aspect, double nearz, double farz)
00387 {VTK_LEGACY_METHOD(GetCompositePerspectiveTransformMatrix,"3.2"); return *this->GetCompositePerspectiveTransformMatrix(aspect,nearz,farz);}
00389 #endif
00390
00391 vtkTransform *GetViewTransformObject() {return this->ViewTransform;};
00392
00393 protected:
00394 vtkCamera();
00395 ~vtkCamera();
00396
00398
00399 void ComputeDistance();
00400 void ComputeViewTransform();
00401 void ComputePerspectiveTransform(double aspect, double nearz, double farz);
00402 void ComputeCompositePerspectiveTransform(double aspect,
00403 double nearz, double farz);
00404 void ComputeCameraLightTransform();
00406
00407 double WindowCenter[2];
00408 double ObliqueAngles[2];
00409 double FocalPoint[3];
00410 double Position[3];
00411 double ViewUp[3];
00412 double ViewAngle;
00413 double ClippingRange[2];
00414 double EyeAngle;
00415 int ParallelProjection;
00416 double ParallelScale;
00417 int Stereo;
00418 int LeftEye;
00419 double Thickness;
00420 double Distance;
00421 double DirectionOfProjection[3];
00422 double ViewPlaneNormal[3];
00423 double ViewShear[3];
00424
00425 vtkTransform *ViewTransform;
00426 vtkPerspectiveTransform *PerspectiveTransform;
00427 vtkPerspectiveTransform *Transform;
00428 vtkTransform *CameraLightTransform;
00429
00430 double FocalDisk;
00431
00432
00433
00434
00435 vtkTimeStamp ViewingRaysMTime;
00436 private:
00437 vtkCamera(const vtkCamera&);
00438 void operator=(const vtkCamera&);
00439 };
00440
00441 #endif
00442