gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
Camera.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 //
6 // Contributed by Gilles Marckmann <gilles.marckmann@ec-nantes.fr>
7 
8 #ifndef CAMERA_H
9 #define CAMERA_H
10 
11 class Quaternion;
12 
13 class XYZ {
14 public:
15  XYZ() : x(0.), y(0.), z(0.){};
16  ~XYZ(){};
17  XYZ(double _x, double _y, double _z);
18  double x, y, z;
19  void set(const double &_x, const double &_y, const double &_z);
20  XYZ(const Quaternion &R);
21 };
22 
23 double length(XYZ &p);
24 void normalize(XYZ &p);
25 void rotate(const Quaternion &omega, XYZ axe);
26 XYZ operator*(const double &a, const XYZ &T);
27 XYZ operator+(const XYZ &L, const XYZ &R);
28 XYZ operator-(const XYZ &L, const XYZ &R);
29 XYZ operator-(const XYZ &R);
30 
31 class Quaternion {
32 public:
33  double x, y, z, w;
34  Quaternion();
35  Quaternion(const XYZ &R);
36  Quaternion(const XYZ &R, const double &A);
37  ~Quaternion();
38 };
39 
40 double length(Quaternion &quat);
41 void normalize(Quaternion &quat);
43 Quaternion mult(const Quaternion &A, const Quaternion &B);
44 Quaternion operator*(const Quaternion &A, const Quaternion &B);
45 
46 class Camera {
47 public:
48  Camera();
49  ~Camera();
50  bool on;
51  XYZ position; /* camera position */
52  XYZ front; /* View direction vector */
53  XYZ up; /* View up direction */
54  XYZ right; /* View right direction */
55  XYZ target; /* center of rotation and screen */
56  double focallength; /* Focal Length along vd */
58  double aperture; /* Camera aperture */
59  double eyesep; /* Eye separation */
66  void giveViewportDimension(const int &W, const int &H);
67  void lookAtCg();
68  void init();
69  void rotate(double *q);
70  //
71  void move_and_look(double _movfront, double _movright, double _movup,
72  double _rotfront, double _rotright, double _rotup,
73  double _azimut, double _elevation);
74  //
75  void moveRight(double &theta);
76  void moveUp(double &theta);
77  void zoom(double &factor);
78  void update();
79  void affiche();
80  void alongX();
81  void alongY();
82  void alongZ();
83  void upX();
84  void upY();
85  void upZ();
86  void tiltHeadLeft();
87  void tiltHeadRight();
88 };
89 
91 public:
95  int key;
96  int mode;
99 };
100 
101 #endif
Camera::rotate
void rotate(double *q)
Definition: Camera.cpp:277
Quaternion::Quaternion
Quaternion()
Definition: Camera.cpp:455
mouseAndKeyboard::button_middle_down
bool button_middle_down
Definition: Camera.h:93
Camera::screenratio
double screenratio
Definition: Camera.h:61
Camera::radians
double radians
Definition: Camera.h:64
Camera::up
XYZ up
Definition: Camera.h:53
Camera::ndfl
double ndfl
Definition: Camera.h:64
Camera::target
XYZ target
Definition: Camera.h:55
mouseAndKeyboard::~mouseAndKeyboard
~mouseAndKeyboard()
Definition: Camera.h:98
Camera::~Camera
~Camera()
Definition: Camera.cpp:26
Camera::ref_distance
double ref_distance
Definition: Camera.h:61
Camera::screenwidth
int screenwidth
Definition: Camera.h:60
Camera::glFleft
double glFleft
Definition: Camera.h:65
Camera::glFright
double glFright
Definition: Camera.h:65
Quaternion
Definition: Camera.h:31
Camera::update
void update()
Definition: Camera.cpp:190
Camera::tiltHeadRight
void tiltHeadRight()
Definition: Camera.cpp:156
Camera::glFtop
double glFtop
Definition: Camera.h:65
Camera::alongX
void alongX()
Definition: Camera.cpp:45
length
double length(XYZ &p)
Definition: Camera.cpp:351
Camera::eyesep
double eyesep
Definition: Camera.h:59
Camera::right
XYZ right
Definition: Camera.h:54
Camera::affiche
void affiche()
Definition: Camera.cpp:214
XYZ::set
void set(const double &_x, const double &_y, const double &_z)
Definition: Camera.cpp:391
Quaternion::z
double z
Definition: Camera.h:33
Camera::position
XYZ position
Definition: Camera.h:51
Camera::lookAtCg
void lookAtCg()
Definition: Camera.cpp:162
Camera::screenheight
int screenheight
Definition: Camera.h:60
Camera::glFbottom
double glFbottom
Definition: Camera.h:65
Camera::upX
void upX()
Definition: Camera.cpp:69
Camera::focallength
double focallength
Definition: Camera.h:56
Camera::focallength_ratio
double focallength_ratio
Definition: Camera.h:57
Camera::button_middle_down
bool button_middle_down
Definition: Camera.h:62
Camera::Camera
Camera()
Definition: Camera.cpp:21
Camera::distance
double distance
Definition: Camera.h:61
Camera::alongZ
void alongZ()
Definition: Camera.cpp:61
Camera::on
bool on
Definition: Camera.h:50
Camera::glFfar
double glFfar
Definition: Camera.h:64
Camera::zoom
void zoom(double &factor)
Definition: Camera.cpp:271
operator-
XYZ operator-(const XYZ &L, const XYZ &R)
Definition: Camera.cpp:429
normalize
void normalize(XYZ &p)
Definition: Camera.cpp:379
mouseAndKeyboard::key
int key
Definition: Camera.h:95
XYZ::XYZ
XYZ()
Definition: Camera.h:15
Camera::Lc
double Lc
Definition: Camera.h:64
XYZ::~XYZ
~XYZ()
Definition: Camera.h:16
mouseAndKeyboard::mouseAndKeyboard
mouseAndKeyboard()
Definition: Camera.h:97
mouseAndKeyboard::button_right_down
bool button_right_down
Definition: Camera.h:94
Camera::move_and_look
void move_and_look(double _movfront, double _movright, double _movup, double _rotfront, double _rotright, double _rotup, double _azimut, double _elevation)
Definition: Camera.cpp:299
Camera::alongY
void alongY()
Definition: Camera.cpp:53
Camera::moveUp
void moveUp(double &theta)
Definition: Camera.cpp:263
Camera::upZ
void upZ()
Definition: Camera.cpp:123
Quaternion::y
double y
Definition: Camera.h:33
rotate
void rotate(const Quaternion &omega, XYZ axe)
Definition: Camera.cpp:398
mouseAndKeyboard::mode
int mode
Definition: Camera.h:96
Camera::stereoEnable
bool stereoEnable
Definition: Camera.h:63
XYZ::x
double x
Definition: Camera.h:18
Camera::upY
void upY()
Definition: Camera.cpp:96
Camera::glFnear
double glFnear
Definition: Camera.h:64
operator+
XYZ operator+(const XYZ &L, const XYZ &R)
Definition: Camera.cpp:421
Camera::button_left_down
bool button_left_down
Definition: Camera.h:62
Quaternion::~Quaternion
~Quaternion()
Definition: Camera.cpp:457
mouseAndKeyboard
Definition: Camera.h:90
conjugate
Quaternion conjugate(Quaternion quat)
Definition: Camera.cpp:474
Camera::tiltHeadLeft
void tiltHeadLeft()
Definition: Camera.cpp:150
Camera::eye_sep_ratio
double eye_sep_ratio
Definition: Camera.h:64
Camera::moveRight
void moveRight(double &theta)
Definition: Camera.cpp:255
XYZ::y
double y
Definition: Camera.h:18
XYZ::z
double z
Definition: Camera.h:18
Camera::giveViewportDimension
void giveViewportDimension(const int &W, const int &H)
Definition: Camera.cpp:179
Camera
Definition: Camera.h:46
XYZ
Definition: Camera.h:13
operator*
XYZ operator*(const double &a, const XYZ &T)
Definition: Camera.cpp:412
Quaternion::w
double w
Definition: Camera.h:33
mouseAndKeyboard::button_left_down
bool button_left_down
Definition: Camera.h:92
Camera::front
XYZ front
Definition: Camera.h:52
Camera::init
void init()
Definition: Camera.cpp:28
mult
Quaternion mult(const Quaternion &A, const Quaternion &B)
Definition: Camera.cpp:459
Camera::button_right_down
bool button_right_down
Definition: Camera.h:62
Camera::closeness
double closeness
Definition: Camera.h:64
Camera::aperture
double aperture
Definition: Camera.h:58
Quaternion::x
double x
Definition: Camera.h:33
Camera::wd2
double wd2
Definition: Camera.h:64