KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
glut_parapiped.h
Go to the documentation of this file.
1 
35 /* =========================================================================== *
36 |
37 | Copyright (c) 1994-2008 by Kobus Barnard (author).
38 |
39 | Personal and educational use of this code is granted, provided that this
40 | header is kept intact, and that the authorship is not misrepresented, that
41 | its use is acknowledged in publications, and relevant papers are cited.
42 |
43 | For other use contact the author (kobus AT cs DOT arizona DOT edu).
44 |
45 | Please note that the code in this file has not necessarily been adequately
46 | tested. Naturally, there is no guarantee of performance, support, or fitness
47 | for any particular task. Nonetheless, I am interested in hearing about
48 | problems that you encounter.
49 |
50 | Authors:
51 | Luca Del Pero
52 |
53 * =========================================================================== */
54 
55 
66 #ifndef GLUT_PARAPIPED_H_
67 #define GLUT_PARAPIPED_H_
68 
69 #include <gr_cpp/gr_opengl.h>
70 
71 #ifdef KJB_HAVE_GLUT
72 #ifdef MAC_OSX
73 #include <GLUT/glut.h>
74 #else
75 #include <GL/glut.h>
76 #endif
77 #endif
78 
81 
82 #define GLUT_PA_DECREMENT_CHARACTER 'j'
83 #define GLUT_PA_INCREMENT_CHARACTER 'k'
84 #define GLUT_PA_NUMBER_OF_PARAPIPED_PARAMETERS 9
85 
86 #include <m_cpp/m_vector.h>
87 #include <st_cpp/st_parapiped.h>
88 
89 namespace kjb{
90 
91 
107  {
108  public:
109  static int create_glut_parapiped_submenu(void (*iparapiped_submenu_callback)(int i), Parametric_parapiped * pa,
110  bool enable_translation = true, bool enable_pitch = true, bool enable_yaw = true, bool enable_roll = true,
111  bool enable_width = true, bool enable_height = true, bool enable_length = true,
112  unsigned char iincrement_char = GLUT_PA_INCREMENT_CHARACTER,
113  unsigned char idecrement_char = GLUT_PA_DECREMENT_CHARACTER);
114 
119  static void parapiped_submenu_glut(int i);
120 
125  static void keyboard_callback(unsigned char key);
126 
127 
132  static void enable_parapiped() {parapiped_enabled = true;}
133 
138  static void disable_parapiped() {parapiped_enabled = false;}
139 
141  static double retrieve_translation_x_increment() { return increment_steps(GLUT_PA_CENTRE_X);}
143  static double retrieve_translation_y_increment() { return increment_steps(GLUT_PA_CENTRE_Y);}
145  static double retrieve_translation_z_increment() { return increment_steps(GLUT_PA_CENTRE_Z);}
147  static double retrieve_pitch_increment() { return increment_steps(GLUT_PA_PITCH);}
149  static double retrieve_yaw_increment() { return increment_steps(GLUT_PA_YAW);}
151  static double retrieve_roll_increment() { return increment_steps(GLUT_PA_ROLL);}
153  static double retrieve_width_increment() { return increment_steps(GLUT_PA_WIDTH);}
155  static double retrieve_height_increment() { return increment_steps(GLUT_PA_HEIGHT);}
157  static double retrieve_length_increment() { return increment_steps(GLUT_PA_LENGTH);}
158 
160  static void update_translation_x_increment(double iincrement) { increment_steps(GLUT_PA_CENTRE_X) = iincrement;}
162  static void update_translation_y_increment(double iincrement) { increment_steps(GLUT_PA_CENTRE_Y) = iincrement;}
164  static void update_translation_z_increment(double iincrement) { increment_steps(GLUT_PA_CENTRE_Z) = iincrement;}
166  static void update_pitch_increment(double iincrement) { increment_steps(GLUT_PA_PITCH) = iincrement;}
168  static void update_yaw_increment(double iincrement) { increment_steps(GLUT_PA_YAW) = iincrement;}
170  static void update_roll_increment(double iincrement) { increment_steps(GLUT_PA_ROLL) = iincrement;}
172  static void update_width_increment(double iincrement) { increment_steps(GLUT_PA_WIDTH) = iincrement;}
174  static void update_height_increment(double iincrement) { increment_steps(GLUT_PA_HEIGHT) = iincrement;}
176  static void update_lenght_increment(double iincrement) { increment_steps(GLUT_PA_LENGTH) = iincrement;}
177 
178  private:
179  static bool parapiped_enabled;
180  static unsigned int selected_parameter;
182  static Parametric_parapiped * parapiped;
183  static unsigned char increment_character;
184  static unsigned char decrement_character;
185  static kjb::Vector increment_steps;
186  };
187 }
188 
189 static void (*parapiped_submenu_callback)(int i);
190 
191 #endif /* GLUT_PARAPIPED_H_ */
static double retrieve_translation_x_increment()
returns the increment step used for the x-coordinate of the centre
Definition: glut_parapiped.h:141
static double retrieve_translation_y_increment()
returns the increment step used for the y-coordinate of the centre
Definition: glut_parapiped.h:143
static void update_pitch_increment(double iincrement)
sets the increment step used for the pitch
Definition: glut_parapiped.h:166
static void update_lenght_increment(double iincrement)
sets the increment step used for the length (along z axis)
Definition: glut_parapiped.h:176
#define GLUT_PA_INCREMENT_CHARACTER
Definition: glut_parapiped.h:83
#define GLUT_PA_DECREMENT_CHARACTER
Definition: glut_parapiped.h:82
Definition: glut_parapiped.h:106
static double retrieve_yaw_increment()
returns the increment step used for the yaw
Definition: glut_parapiped.h:149
static void update_translation_z_increment(double iincrement)
sets the increment step used for the z-coordinate of the centre
Definition: glut_parapiped.h:164
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
static double retrieve_length_increment()
returns the increment step used for the length (along z axis)
Definition: glut_parapiped.h:157
static void update_translation_x_increment(double iincrement)
sets the increment step used for the x-coordinate of the centre
Definition: glut_parapiped.h:160
Definition: glut_parapiped.h:79
St_perspective_camera for modeling a perspective camera using the classic Forsyth and Ponce parametri...
static int create_glut_parapiped_submenu(void(*iparapiped_submenu_callback)(int i), Parametric_parapiped *pa, bool enable_translation=true, bool enable_pitch=true, bool enable_yaw=true, bool enable_roll=true, bool enable_width=true, bool enable_height=true, bool enable_length=true, unsigned char iincrement_char=GLUT_PA_INCREMENT_CHARACTER, unsigned char idecrement_char=GLUT_PA_DECREMENT_CHARACTER)
Definition: glut_parapiped.cpp:80
static void parapiped_submenu_glut(int i)
This callback will be executed any time an entry of the parapiped submenu is selected. This is automatically called. Within this function the user defined callback will be called.
Definition: glut_parapiped.cpp:135
Definition: glut_parapiped.h:80
static double retrieve_width_increment()
returns the increment step used for the width (along x axis)
Definition: glut_parapiped.h:153
Definition: glut_parapiped.h:79
Definition: glut_parapiped.h:79
static void update_roll_increment(double iincrement)
sets the increment step used for the roll
Definition: glut_parapiped.h:170
static void update_translation_y_increment(double iincrement)
sets the increment step used for the y-coordinate of the centre
Definition: glut_parapiped.h:162
static void update_height_increment(double iincrement)
sets the increment step used for the height (along y axis)
Definition: glut_parapiped.h:174
static double retrieve_translation_z_increment()
returns the increment step used for the z-coordinate of the centre
Definition: glut_parapiped.h:145
Definition: glut_parapiped.h:80
static void update_width_increment(double iincrement)
sets the increment step used for the width (along x axis)
Definition: glut_parapiped.h:172
static double retrieve_roll_increment()
returns the increment step used for the roll
Definition: glut_parapiped.h:151
static void disable_parapiped()
Disables the parapiped. When the camera is not enabled all submenu selections and the submenu keyboar...
Definition: glut_parapiped.h:138
Definition: glut_parapiped.h:79
static void enable_parapiped()
Enables the parapiped. When the camera is not enabled all submenu selections and the submenu keyboard...
Definition: glut_parapiped.h:132
static double retrieve_height_increment()
returns the increment step used for the height (along y axis)
Definition: glut_parapiped.h:155
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
Definition: glut_parapiped.h:79
Definition: glut_parapiped.h:80
static double retrieve_pitch_increment()
returns the increment step used for the pitch
Definition: glut_parapiped.h:147
Definition: glut_parapiped.h:79
static void update_yaw_increment(double iincrement)
sets the increment step used for the yaw
Definition: glut_parapiped.h:168
static void keyboard_callback(unsigned char key)
This is the keyboard_callback for this parapiped submenu. The user HAS to call this in the GLUT keybo...
Definition: glut_parapiped.cpp:141
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
Definition: st_parapiped.h:99