21 std::vector<float> tmp_vector;
23 for(
const auto& [angle, distance] : obstacleData)
25 float radianAngle = ((angle + 1) *
PI) / 180.0;
27 float x = distance *
__scale * cos(radianAngle);
28 float y = distance *
__scale * sin(radianAngle);
31 tmp_vector.push_back(distance);
34 float min = *std::min_element(std::begin(tmp_vector), std::end(tmp_vector));
35 float max = *std::max_element(std::begin(tmp_vector), std::end(tmp_vector));
37 for(
unsigned long i = 0; i < tmp_vector.size(); i++)
39 float value = tmp_vector[i];
40 float colour = (value - min) / (max - min) * 255.0;
50 glClearColor(0.5, 0.5, 0.5, 1);
66 restoreStateFromFile();
72 QString text(
"<h2>S i m p l e V i e w e r</h2>");
73 text +=
"Use the mouse to move the camera around the object. ";
74 text +=
"You can respectively revolve around, zoom and translate with the three mouse buttons. ";
75 text +=
"Left and middle buttons pressed together rotate around the camera view direction axis<br><br>";
76 text +=
"Pressing <b>Alt</b> and one of the function keys (<b>F1</b>..<b>F12</b>) defines a camera keyFrame. ";
77 text +=
"Simply press the function key again to restore it. Several keyFrames define a ";
78 text +=
"camera path. Paths are saved when you quit the application and restored at next start.<br><br>";
79 text +=
"Press <b>F</b> to display the frame rate, <b>A</b> for the world axis, ";
80 text +=
"<b>Alt+Return</b> for full screen mode and <b>Control+S</b> to save a snapshot. ";
81 text +=
"See the <b>Keyboard</b> tab in this window for a complete shortcut list.<br><br>";
82 text +=
"Double clicks automates single click actions: A left button double click aligns the closer axis with the "
83 "camera (if close enough). ";
85 "A middle button double click fits the zoom of the camera and the right button re-centers the scene.<br><br>";
86 text +=
"A left button double click while holding right button pressed defines the camera <i>Revolve Around "
88 text +=
"See the <b>Mouse</b> tab and the documentation web pages for details.<br><br>";
89 text +=
"Press <b>Escape</b> to exit the viewer.";
101 glRotatef(90, 0, 1, 0);
107 glRotatef(-90, 0, 1, 0);
116 glTranslatef(x, y, z);
128 glVertex3f(size, -size, size);
129 glVertex3f(size, size, size);
130 glVertex3f(-size, size, size);
131 glVertex3f(-size, -size, size);
136 glVertex3f(size, -size, -size);
137 glVertex3f(size, size, -size);
138 glVertex3f(size, size, size);
139 glVertex3f(size, -size, size);
144 glVertex3f(-size, -size, size);
145 glVertex3f(-size, size, size);
146 glVertex3f(-size, size, -size);
147 glVertex3f(-size, -size, -size);
152 glVertex3f(size, size, size);
153 glVertex3f(size, size, -size);
154 glVertex3f(-size, size, -size);
155 glVertex3f(-size, size, size);
160 glVertex3f(size, -size, -size);
161 glVertex3f(size, -size, size);
162 glVertex3f(-size, -size, size);
163 glVertex3f(-size, -size, -size);
174 GLfloat angle_stepsize = 0.1;
178 glBegin(GL_QUAD_STRIP);
180 while(angle < 2 *
PI)
182 x = radius * cos(angle);
183 y = radius * sin(angle);
184 glVertex3f(x, y, height);
185 glVertex3f(x, y, 0.0);
186 angle = angle + angle_stepsize;
188 glVertex3f(radius, 0.0, height);
189 glVertex3f(radius, 0.0, 0.0);
196 while(angle < 2 *
PI)
198 x = radius * cos(angle);
199 y = radius * sin(angle);
200 glVertex3f(x, y, height);
201 angle = angle + angle_stepsize;
203 glVertex3f(radius, 0.0, height);
210 while(angle < 2 *
PI)
212 x = radius * cos(angle);
213 y = radius * sin(angle);
215 angle = angle + angle_stepsize;
217 glVertex3f(radius, 0.0, 0);