iCub-main
Loading...
Searching...
No Matches
icub-main
src
tools
iCubGui
src
camera.cpp
Go to the documentation of this file.
1
/*
2
* camera.cpp
3
*/
4
5
/*
6
* Copyright (C) 2009 RobotCub Consortium
7
* Author: Alessandro Scalzo alessandro.scalzo@iit.it
8
* CopyPolicy: Released under the terms of the GNU GPL v2.0.
9
*
10
* Based on:
11
*
12
* Qavimator
13
* Copyright (C) 2006 by Zi Ree *
14
* Zi Ree @ SecondLife *
15
* Released under the terms of the GNU GPL v2.0.
16
*/
17
18
#ifdef __APPLE__
19
#include <OpenGL/glu.h>
20
#else
21
#if defined(WIN32) || defined(WIN64)
22
#include <windows.h>
23
#endif
24
#include <GL/glu.h>
25
#endif
26
27
#include "
camera.h
"
28
29
Camera::Camera
()
30
{
31
reset
();
32
}
33
34
void
Camera::rotate
(
float
x
,
float
y
)
35
{
36
rotX +=
x
;
37
if
(rotX < 2) rotX = 2;
38
if
(rotX > 80) rotX = 80;
39
rotY +=
y
;
40
if
(rotY < 0) rotY += 360;
41
if
(rotY > 360) rotY -= 360;
42
}
43
44
void
Camera::pan
(
float
x
,
float
y
,
float
z
)
45
{
46
panX -=
x
/2;
47
if
(panX < -500) panX = -500;
48
if
(panX > 500) panX = 500;
49
panY +=
y
/2;
50
if
(panY < 5) panY = 5;
51
if
(panY > 500) panY = 500;
52
panZ +=
z
;
53
if
(panZ < 10) panZ = 10;
54
if
(panZ > 1000) panZ = 1000;
55
}
56
57
void
Camera::setModelView
()
58
{
59
glMatrixMode(GL_MODELVIEW);
60
glLoadIdentity();
61
gluLookAt(panX, panY, panZ, panX, panY, 0, 0, 1, 0);
62
glRotatef(rotX, 1, 0, 0);
63
glRotatef(rotY, 0, 1, 0);
64
}
65
66
void
Camera::reset
()
67
{
68
rotX = 10;
69
rotY = 0;
70
panX = 0;
71
panY = 40;
72
panZ = 100;
73
}
74
75
float
Camera::xRotation
()
const
76
{
77
return
rotX;
78
}
79
80
float
Camera::yRotation
()
const
81
{
82
return
rotY;
83
}
camera.h
Camera::Camera
Camera()
Definition
camera.cpp:29
Camera::reset
void reset()
Definition
camera.cpp:66
Camera::setModelView
void setModelView()
Definition
camera.cpp:57
Camera::xRotation
float xRotation() const
Definition
camera.cpp:75
Camera::yRotation
float yRotation() const
Definition
camera.cpp:80
Camera::rotate
void rotate(float x, float y)
Definition
camera.cpp:34
Camera::pan
void pan(float x, float y, float z)
Definition
camera.cpp:44
x
x
Definition
compute_ekf_sym.m:21
z
z
Definition
show_eyes_axes.m:22
y
y
Definition
show_eyes_axes.m:21
Generated on Wed Dec 18 2024 16:34:48 for iCub-main by
1.9.8