KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
glut_polymesh.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_POLYMESH_H_
67 #define GLUT_POLYMESH_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_PM_DECREMENT_CHARACTER 'j'
83 #define GLUT_PM_INCREMENT_CHARACTER 'k'
84 #define GLUT_PM_NUMBER_OF_POLYMESH_PARAMETERS 9
85 
86 #include <m_cpp/m_vector.h>
87 #include <gr_cpp/gr_polymesh.h>
88 #include <g_cpp/g_quaternion.h>
89 
90 namespace kjb{
91 
92 
108  {
109  public:
110  static int create_glut_polymesh_submenu(void (*ipolymesh_submenu_callback)(int i), Polymesh * pa,
111  bool enable_translation = true, bool enable_pitch = true, bool enable_yaw = true, bool enable_roll = true,
112  bool enable_width = true, bool enable_height = true, bool enable_length = true,
113  unsigned char iincrement_char = GLUT_PM_INCREMENT_CHARACTER,
114  unsigned char idecrement_char = GLUT_PM_DECREMENT_CHARACTER);
115 
120  static void polymesh_submenu_glut(int i);
121 
126  static void keyboard_callback(unsigned char key);
127 
128 
133  static void enable_polymesh() {polymesh_enabled = true;}
134 
139  static void disable_polymesh() {polymesh_enabled = false;}
140 
142  static double retrieve_translation_x_increment() { return increment_steps(GLUT_PM_TRANSLATE_X);}
144  static double retrieve_translation_y_increment() { return increment_steps(GLUT_PM_TRANSLATE_Y);}
146  static double retrieve_translation_z_increment() { return increment_steps(GLUT_PM_TRANSLATE_Z);}
148  static double retrieve_pitch_increment() { return increment_steps(GLUT_PM_PITCH);}
150  static double retrieve_yaw_increment() { return increment_steps(GLUT_PM_YAW);}
152  static double retrieve_roll_increment() { return increment_steps(GLUT_PM_ROLL);}
154  static double retrieve_width_increment() { return increment_steps(GLUT_PM_SCALE_X);}
156  static double retrieve_height_increment() { return increment_steps(GLUT_PM_SCALE_Y);}
158  static double retrieve_length_increment() { return increment_steps(GLUT_PM_SCALE_Z);}
159 
161  static void update_translation_x_increment(double iincrement) { increment_steps(GLUT_PM_TRANSLATE_X) = iincrement;}
163  static void update_translation_y_increment(double iincrement) { increment_steps(GLUT_PM_TRANSLATE_Y) = iincrement;}
165  static void update_translation_z_increment(double iincrement) { increment_steps(GLUT_PM_TRANSLATE_Z) = iincrement;}
167  static void update_pitch_increment(double iincrement) { increment_steps(GLUT_PM_PITCH) = iincrement;}
169  static void update_yaw_increment(double iincrement) { increment_steps(GLUT_PM_YAW) = iincrement;}
171  static void update_roll_increment(double iincrement) { increment_steps(GLUT_PM_ROLL) = iincrement;}
173  static void update_width_increment(double iincrement) { increment_steps(GLUT_PM_SCALE_X) = iincrement;}
175  static void update_height_increment(double iincrement) { increment_steps(GLUT_PM_SCALE_Y) = iincrement;}
177  static void update_lenght_increment(double iincrement) { increment_steps(GLUT_PM_SCALE_Z) = iincrement;}
178 
179  private:
180  static bool polymesh_enabled;
181  static unsigned int selected_parameter;
183  static Polymesh * polymesh;
184  static unsigned char increment_character;
185  static unsigned char decrement_character;
186  static kjb::Vector increment_steps;
187  static kjb::Vector _angles;
188  };
189 }
190 
191 static void (*polymesh_submenu_callback)(int i);
192 
193 #endif /* GLUT_POLYMESH_H_ */
Definition: glut_polymesh.h:80
static void update_width_increment(double iincrement)
sets the increment step used for the width (along x axis)
Definition: glut_polymesh.h:173
static void update_lenght_increment(double iincrement)
sets the increment step used for the length (along z axis)
Definition: glut_polymesh.h:177
Definition: glut_polymesh.h:79
Definition: glut_polymesh.h:79
static double retrieve_translation_x_increment()
returns the increment step used for translating along the x-axis
Definition: glut_polymesh.h:142
static double retrieve_roll_increment()
returns the increment step used for the roll
Definition: glut_polymesh.h:152
Definition: glut_polymesh.h:107
static double retrieve_pitch_increment()
returns the increment step used for the pitch
Definition: glut_polymesh.h:148
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
static void update_translation_z_increment(double iincrement)
sets the increment step used for translating along the z-axis
Definition: glut_polymesh.h:165
Definition: glut_polymesh.h:80
Definition: glut_polymesh.h:80
static void enable_polymesh()
Enables the polymesh. When the camera is not enabled all submenu selections and the submenu keyboard ...
Definition: glut_polymesh.h:133
Abstract class of connected polygons (faces) forming a mesh.
static void update_height_increment(double iincrement)
sets the increment step used for the height (along y axis)
Definition: glut_polymesh.h:175
static void disable_polymesh()
Disables the polymesh. When the camera is not enabled all submenu selections and the submenu keyboard...
Definition: glut_polymesh.h:139
static double retrieve_length_increment()
returns the increment step used for the length (along z axis)
Definition: glut_polymesh.h:158
static void update_yaw_increment(double iincrement)
sets the increment step used for the yaw
Definition: glut_polymesh.h:169
static void update_roll_increment(double iincrement)
sets the increment step used for the roll
Definition: glut_polymesh.h:171
static double retrieve_height_increment()
returns the increment step used for the height (along y axis)
Definition: glut_polymesh.h:156
static double retrieve_yaw_increment()
returns the increment step used for the yaw
Definition: glut_polymesh.h:150
#define GLUT_PM_INCREMENT_CHARACTER
Definition: glut_polymesh.h:83
Abstract class of connected polygons (faces) forming a mesh. We assume that each edge is shared betwe...
Definition: gr_polymesh.h:89
static void polymesh_submenu_glut(int i)
This callback will be executed any time an entry of the polymesh submenu is selected. This is automatically called. Within this function the user defined callback will be called.
Definition: glut_polymesh.cpp:137
static int create_glut_polymesh_submenu(void(*ipolymesh_submenu_callback)(int i), Polymesh *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_PM_INCREMENT_CHARACTER, unsigned char idecrement_char=GLUT_PM_DECREMENT_CHARACTER)
Definition: glut_polymesh.cpp:82
static double retrieve_translation_y_increment()
returns the increment step used for translating along the x-axis
Definition: glut_polymesh.h:144
static void keyboard_callback(unsigned char key)
This is the keyboard_callback for this polymesh submenu. The user HAS to call this in the GLUT keyboa...
Definition: glut_polymesh.cpp:143
Definition: glut_polymesh.h:79
#define GLUT_PM_DECREMENT_CHARACTER
Definition: glut_polymesh.h:82
Definition: glut_polymesh.h:79
static double retrieve_translation_z_increment()
returns the increment step used for translating along the z-axis
Definition: glut_polymesh.h:146
static void update_pitch_increment(double iincrement)
sets the increment step used for the pitch
Definition: glut_polymesh.h:167
static void update_translation_y_increment(double iincrement)
sets the increment step used for translating along the y-axis
Definition: glut_polymesh.h:163
Definition: glut_polymesh.h:79
static double retrieve_width_increment()
returns the increment step used for the width (along x axis)
Definition: glut_polymesh.h:154
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
Definition: glut_polymesh.h:79
static void update_translation_x_increment(double iincrement)
sets the increment step used for translating along the x-axis
Definition: glut_polymesh.h:161
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...