Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CameraViewExternals.cpp
1 #include "CameraViewExternals.hh"
2 #include <iostream>
3 #include <Base/Debug/Error.hh>
4 #include <Base/Debug/DebugSimple.hh>
5 
6 #ifdef BIAS_HAVE_OPENGL
7 # include <Gui/biasgl.h>
8 #endif //BIAS_HAVE_OPENGL
9 
10 
11 using namespace std;
12 using namespace BIAS;
13 
14 
15 CameraViewExternals::CameraViewExternals()
16 {
17  InitMembers();
18 }
19 
20 CameraViewExternals::CameraViewExternals(const BIAS::Vector3<double> & vC,
21  const BIAS::Vector3<double> & vup,
22  const BIAS::Vector3<double> & vviewAt)
23  : C(vC), up(vup), viewAt(vviewAt)
24 {}
25 
26 
27 std::ostream & BIAS::CameraViewExternals::Print(std::ostream & os)
28 {
29  os<<"CameraViewExternals : "<<endl
30  <<"C "<<C<<endl
31  <<"viewAt "<<viewAt<<endl
32  <<"up "<<up<<endl
33  <<endl;
34  return os;
35 }
36 
37 #ifdef BIAS_HAVE_OPENGL
39 {
40  glMatrixMode(GL_MODELVIEW);
41  glLoadIdentity();
42  gluLookAt(
43  (GLdouble)C[0],
44  (GLdouble)C[1],
45  (GLdouble)C[2],
46  (GLdouble)viewAt[0],
47  (GLdouble)viewAt[1],
48  (GLdouble)viewAt[2],
49  (GLdouble)up[0],
50  (GLdouble)up[1],
51  (GLdouble)up[2]
52  );
53 }
54 
55 void BIAS::CameraViewExternals::DisplayViewAt(const double & size) const
56 {
57  glMatrixMode(GL_MODELVIEW);
58  glPushMatrix();
59  glPushAttrib(GL_POINT_BIT);
60  glPointSize(7);
61  static bool blink=true;
62  blink=!blink;
63  if (blink){
64  glColor3f(1.0, 1.0, 1.0);
65  } else {
66  glColor3f(0.0, 0.0, 0.0);
67  }
68  glBegin(GL_POINTS);
69  glVertex3dv(&viewAt[0]);
70  glEnd();
71  glPopAttrib();
72  glPopMatrix();
73 }
74 #endif // BIAS_HAVE_OPENGL
75 
void DisplayViewAt(const double &size=1.0) const
std::ostream & Print(std::ostream &os=std::cout)