source: GTP/trunk/Lib/Vis/Preprocessing/src/Camera.h @ 2176

Revision 2176, 1.5 KB checked in by mattausch, 18 years ago (diff)

removed using namespace std from .h

RevLine 
[162]1#ifndef __CAMERA_H
2#define __CAMERA_H
3
4#include "Vector3.h"
5#include "AxisAlignedBox3.h"
6
[860]7namespace GtpVisibilityPreprocessor {
8
[162]9class KdTree;
[492]10class SceneGraph;
[162]11
[860]12
[162]13class Camera
14{
15public:
16  Vector3 mPosition;
17  Vector3 mDirection;
18  /** up vector takes into account the FOV at a unit distance from the origin */
19  Vector3 mUp;
20  /** right vector takes into account the FOV at a unit distance from the origin */
21  Vector3 mRight;
22
23  float mFovy;
24  int mWidth;
25  int mHeight;
26 
27  Camera() {
[1583]28    mWidth = 100;
29    mHeight = 100;
[878]30    mFovy = 90.0f*(float)M_PI/180.0f;
[162]31  }
32 
33  void Precompute() {
34    mDirection.Normalize();
35    Vector3 side = CrossProd(Vector3(0,1,0), mDirection);
36    mUp = Normalize(CrossProd(side, mDirection));
37    mRight = Normalize(CrossProd(mDirection, mUp));
38    float k = tan(mFovy/2);
39    mUp *= k;
40    mRight *= k*mWidth/mHeight;
41  }
42
43  void SetPosition(const Vector3 &pos) {
44    mPosition = pos;
45    Precompute();
46  }
47
[386]48        void SetDirection(const Vector3 &dir) {
49    mDirection = dir;
50    Precompute();
51  }
52
[162]53  void LookInBox(const AxisAlignedBox3 &box)
54  {
55    mDirection = Vector3(0,0,1);
56    mPosition = box.Center();
57    Precompute();
58  }
59   
60
61  void LookAtBox(const AxisAlignedBox3 &box)
62  {
63    mDirection = box.Max() - box.Min();
64    mPosition = box.Min() - mDirection;
65    Precompute();
66  }
67 
68  bool
[2176]69          SnapImage(std::string filename,
[492]70                        KdTree *tree,
71                        SceneGraph *sceneGraph
72                        );
[162]73
74  void SetupRay(Ray &ray, const int x, const int y);
75
76};
77
[863]78};
[162]79
80#endif
Note: See TracBrowser for help on using the repository browser.