VTK
vtkCamera.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCamera.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
34 #ifndef __vtkCamera_h
35 #define __vtkCamera_h
36 
37 #include "vtkObject.h"
38 
40 class vtkMatrix4x4;
42 class vtkRenderer;
43 class vtkTransform;
44 class vtkCallbackCommand;
45 class vtkCameraCallbackCommand;
46 
48 {
49 public:
50  void PrintSelf(ostream& os, vtkIndent indent);
51  vtkTypeMacro(vtkCamera,vtkObject);
52 
56  static vtkCamera *New();
57 
59 
61  void SetPosition(double x, double y, double z);
62  void SetPosition(const double a[3]) {
63  this->SetPosition(a[0], a[1], a[2]); };
64  vtkGetVector3Macro(Position,double);
66 
68 
70  void SetFocalPoint(double x, double y, double z);
71  void SetFocalPoint(const double a[3]) {
72  this->SetFocalPoint(a[0], a[1], a[2]);};
73  vtkGetVector3Macro(FocalPoint,double);
75 
77 
79  void SetViewUp(double vx, double vy, double vz);
80  void SetViewUp(const double a[3]) {
81  this->SetViewUp(a[0], a[1], a[2]); }
82  vtkGetVector3Macro(ViewUp,double);
84 
88  void OrthogonalizeViewUp();
89 
92  void SetDistance(double);
93 
95 
97  vtkGetMacro(Distance,double);
99 
101 
104  vtkGetVector3Macro(DirectionOfProjection,double);
106 
111  void Dolly(double value);
112 
114 
115  void SetRoll(double angle);
116  double GetRoll();
118 
121  void Roll(double angle);
122 
127  void Azimuth(double angle);
128 
134  void Yaw(double angle);
135 
140  void Elevation(double angle);
141 
145  void Pitch(double angle);
146 
148 
151  void SetParallelProjection(int flag);
152  vtkGetMacro(ParallelProjection,int);
153  vtkBooleanMacro(ParallelProjection,int);
155 
157 
163  void SetUseHorizontalViewAngle(int flag);
164  vtkGetMacro(UseHorizontalViewAngle, int);
165  vtkBooleanMacro(UseHorizontalViewAngle, int);
167 
169 
176  void SetViewAngle(double angle);
177  vtkGetMacro(ViewAngle,double);
179 
181 
186  void SetParallelScale(double scale);
187  vtkGetMacro(ParallelScale,double);
189 
194  void Zoom(double factor);
195 
197 
204  void SetClippingRange(double dNear, double dFar);
205  void SetClippingRange(const double a[2]) {
206  this->SetClippingRange(a[0], a[1]); };
207  vtkGetVector2Macro(ClippingRange,double);
209 
211 
214  void SetThickness(double);
215  vtkGetMacro(Thickness,double);
217 
219 
224  void SetWindowCenter(double x, double y);
225  vtkGetVector2Macro(WindowCenter,double);
227 
236  void SetObliqueAngles(double alpha, double beta);
237 
241  void ApplyTransform(vtkTransform *t);
242 
244 
247  vtkGetVector3Macro(ViewPlaneNormal,double);
249 
251 
255  void SetViewShear(double dxdz, double dydz, double center);
256  void SetViewShear(double d[3]);
257  vtkGetVector3Macro(ViewShear, double);
259 
261 
263  vtkSetMacro(EyeAngle,double);
264  vtkGetMacro(EyeAngle,double);
266 
268 
272  vtkSetMacro(FocalDisk,double);
273  vtkGetMacro(FocalDisk,double);
275 
280  virtual vtkMatrix4x4 *GetViewTransformMatrix();
281 
283 
288  {
289  return this->ViewTransform;
290  }
292 
294 
303  VTK_LEGACY(virtual vtkMatrix4x4 *GetPerspectiveTransformMatrix(double aspect,
304  double nearz,
305  double farz));
307 
309 
315  virtual vtkMatrix4x4 *GetProjectionTransformMatrix(double aspect,
316  double nearz,
317  double farz);
319 
321 
327  virtual vtkPerspectiveTransform *GetProjectionTransformObject(double aspect,
328  double nearz,
329  double farz);
331 
332 
334 
344  VTK_LEGACY(virtual vtkMatrix4x4 *GetCompositePerspectiveTransformMatrix(
345  double aspect,
346  double nearz,
347  double farz));
349 
351 
358  virtual vtkMatrix4x4 *GetCompositeProjectionTransformMatrix(double aspect,
359  double nearz,
360  double farz);
362 
363 
365 
369  void SetUserViewTransform(vtkHomogeneousTransform *transform);
370  vtkGetObjectMacro(UserViewTransform,vtkHomogeneousTransform);
372 
374 
378  void SetUserTransform(vtkHomogeneousTransform *transform);
379  vtkGetObjectMacro(UserTransform,vtkHomogeneousTransform);
381 
385  virtual void Render(vtkRenderer *) {}
386 
389  unsigned long GetViewingRaysMTime();
390 
393  void ViewingRaysModified();
394 
402  virtual void GetFrustumPlanes(double aspect, double planes[24]);
403 
405 
406  double *GetOrientation();
407  double *GetOrientationWXYZ();
409 
411 
413  VTK_LEGACY(void SetViewPlaneNormal(double x, double y, double z));
414  VTK_LEGACY(void SetViewPlaneNormal(const double a[3]));
416 
419  void ComputeViewPlaneNormal();
420 
424  vtkMatrix4x4 *GetCameraLightTransformMatrix();
425 
427  virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
428 
430 
431  vtkSetMacro(LeftEye,int);
432  vtkGetMacro(LeftEye,int);
434 
439  void ComputeProjAndViewParams( );
440 
442 
443  void SetConfigParams( double o2screen, double o2right, double o2left,
444  double o2top, double o2bottom , double interOccDist,
445  double scale, vtkMatrix4x4 * surfaceRot );
446  // Description:
447  // This function is a convinience function intended for the Paraview
448  // ServerManager
449  void SetHeadPose( double x00, double x01, double x02, double x03,
450  double x10, double x11, double x12, double x13,
451  double x20, double x21, double x22, double x23,
452  double x30, double x31, double x32, double x33 );
454 
456 
458  vtkSetMacro(HeadTracked,int);
459  vtkGetMacro(HeadTracked,int);
461 
464  void ShallowCopy(vtkCamera *source);
465 
468  void DeepCopy(vtkCamera *source);
469 
470 protected:
471  vtkCamera();
472  ~vtkCamera();
473 
475 
476  void ComputeDistance();
477  void ComputeViewTransform();
479 
480 #ifndef VTK_LEGACY_REMOVE
481 
482 
483  void ComputePerspectiveTransform(double aspect,
484  double nearz,
485  double farz);
487 
489 
491  void ComputeCompositePerspectiveTransform(double aspect,
492  double nearz,
493  double farz);
494 #endif
495 
496 
498 
499  void ComputeProjectionTransform(double aspect,
500  double nearz,
501  double farz);
503 
505 
506  void ComputeCompositeProjectionTransform(double aspect,
507  double nearz,
508  double farz);
510 
513  vtkMatrix4x4* SetTranslation( vtkMatrix4x4 mat );
514 
515  void ComputeCameraLightTransform();
516 
519  void SetSurface2Base( vtkMatrix4x4 *head );
520 
523  void PartialCopy(vtkCamera *source);
524 
525  double WindowCenter[2];
526  double ObliqueAngles[2];
527  double FocalPoint[3];
528  double Position[3];
529  double ViewUp[3];
530  double ViewAngle;
531  double ClippingRange[2];
532  double EyeAngle;
535  int Stereo;
536  int LeftEye;
537  double Thickness;
538  double Distance;
539  double DirectionOfProjection[3];
540  double ViewPlaneNormal[3];
541  double ViewShear[3];
545 
550 
551  double FocalDisk;
552 //BTX
553  vtkCameraCallbackCommand *UserViewTransformCallbackCommand;
554  friend class vtkCameraCallbackCommand;
555 //ETX
556 
557  // ViewingRaysMtime keeps track of camera modifications which will
558  // change the calculation of viewing rays for the camera before it is
559  // transformed to the camera's location and orientation.
561 
562  // Asymmetric Frustum
567 
568  double AsymLeft, AsymRight, AsymBottom, AsymTop;
569  double EyePos[3];
570  double O2Screen;
571  double O2Right;
572  double O2Left;
573  double O2Top;
574  double O2Bottom;
575  double EyeOffset;
576  double ScaleFactor;
577 
578  // temp
582 
583 private:
584  vtkCamera(const vtkCamera&); // Not implemented.
585  void operator=(const vtkCamera&); // Not implemented.
586 };
587 
588 #endif
589 
vtkHomogeneousTransform * UserTransform
Definition: vtkCamera.h:543
vtkMatrix4x4 * eyeOffsetMat
Definition: vtkCamera.h:581
int ParallelProjection
Definition: vtkCamera.h:533
abstract base class for most VTK objects
Definition: vtkObject.h:60
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:37
void SetViewUp(const double a[3])
Definition: vtkCamera.h:80
superclass for homogeneous transformations
int UseHorizontalViewAngle
Definition: vtkCamera.h:542
record modification and/or execution time
Definition: vtkTimeStamp.h:33
double ViewAngle
Definition: vtkCamera.h:530
abstract specification for renderers
Definition: vtkRenderer.h:69
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:58
void SetPosition(const double a[3])
Definition: vtkCamera.h:62
vtkTransform * ViewTransform
Definition: vtkCamera.h:546
double Distance
Definition: vtkCamera.h:538
double O2Top
Definition: vtkCamera.h:573
virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren))
Definition: vtkCamera.h:427
double Thickness
Definition: vtkCamera.h:537
double AsymTop
Definition: vtkCamera.h:568
supports function callbacks
double EyeOffset
Definition: vtkCamera.h:575
virtual void PrintSelf(ostream &os, vtkIndent indent)
double ParallelScale
Definition: vtkCamera.h:534
vtkMatrix4x4 * HeadTrackedViewMat
Definition: vtkCamera.h:566
a simple class to control print indentation
Definition: vtkIndent.h:37
vtkTransform * Surface2Base
Definition: vtkCamera.h:565
a virtual camera for 3D rendering
Definition: vtkCamera.h:47
virtual void Render(vtkRenderer *)
Definition: vtkCamera.h:385
void SetFocalPoint(const double a[3])
Definition: vtkCamera.h:71
vtkMatrix4x4 * negEyePosMat
Definition: vtkCamera.h:580
vtkCameraCallbackCommand * UserViewTransformCallbackCommand
Definition: vtkCamera.h:553
int LeftEye
Definition: vtkCamera.h:536
vtkTransform * CameraLightTransform
Definition: vtkCamera.h:549
void SetClippingRange(const double a[2])
Definition: vtkCamera.h:205
double O2Left
Definition: vtkCamera.h:572
double FocalDisk
Definition: vtkCamera.h:551
vtkMatrix4x4 * HeadPose
Definition: vtkCamera.h:564
vtkPerspectiveTransform * Transform
Definition: vtkCamera.h:548
virtual vtkTransform * GetViewTransformObject()
Definition: vtkCamera.h:287
#define VTK_RENDERING_EXPORT
double O2Right
Definition: vtkCamera.h:571
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
double O2Bottom
Definition: vtkCamera.h:574
vtkTimeStamp ViewingRaysMTime
Definition: vtkCamera.h:560
int Stereo
Definition: vtkCamera.h:535
vtkHomogeneousTransform * UserViewTransform
Definition: vtkCamera.h:544
double EyeAngle
Definition: vtkCamera.h:532
double ScaleFactor
Definition: vtkCamera.h:576
static vtkObject * New()
double O2Screen
Definition: vtkCamera.h:570
vtkPerspectiveTransform * ProjectionTransform
Definition: vtkCamera.h:547
vtkMatrix4x4 * eyePosMat
Definition: vtkCamera.h:579
describes a 4x4 matrix transformation
int HeadTracked
Definition: vtkCamera.h:563