@@ -165,72 +165,6 @@ FrameworkReturnCode SolAR3DPointsViewerOpengl::display (const std::vector<CloudP
165165 return FrameworkReturnCode::_SUCCESS;
166166}
167167
168- FrameworkReturnCode SolAR3DPointsViewerOpengl::display (const std::vector<Edge3Df>& lines3D, const Transform3Df & pose)
169- {
170- m_lines = lines3D;
171- m_cameraPose = pose;
172-
173- if (m_firstDisplay)
174- {
175- // Compute the center point of the point cloud
176- Point3Df minPoint, maxPoint;
177- maxPoint (0 ) = (std::numeric_limits<size_t >::lowest)();
178- maxPoint (1 ) = (std::numeric_limits<size_t >::lowest)();
179- maxPoint (2 ) = (std::numeric_limits<size_t >::lowest)();
180- minPoint (0 ) = (std::numeric_limits<size_t >::max)();
181- minPoint (1 ) = (std::numeric_limits<size_t >::max)();
182- minPoint (2 ) = (std::numeric_limits<size_t >::max)();
183-
184- for (int i = 0 ; i < m_lines.size (); i++)
185- {
186- // Start point check
187- if (m_lines[i].p1 .getX () > maxPoint (0 )) maxPoint (0 ) = m_lines[i].p1 .getX ();
188- if (m_lines[i].p1 .getZ () > maxPoint (2 )) maxPoint (2 ) = m_lines[i].p1 .getZ ();
189- if (m_lines[i].p1 .getX () < minPoint (0 )) minPoint (0 ) = m_lines[i].p1 .getX ();
190- if (m_lines[i].p1 .getY () < minPoint (1 )) minPoint (1 ) = m_lines[i].p1 .getY ();
191- if (m_lines[i].p1 .getZ () < minPoint (2 )) minPoint (2 ) = m_lines[i].p1 .getZ ();
192- // End point check
193- if (m_lines[i].p2 .getX () > maxPoint (0 )) maxPoint (0 ) = m_lines[i].p2 .getX ();
194- if (m_lines[i].p2 .getZ () > maxPoint (2 )) maxPoint (2 ) = m_lines[i].p2 .getZ ();
195- if (m_lines[i].p2 .getX () < minPoint (0 )) minPoint (0 ) = m_lines[i].p2 .getX ();
196- if (m_lines[i].p2 .getY () < minPoint (1 )) minPoint (1 ) = m_lines[i].p2 .getY ();
197- if (m_lines[i].p2 .getZ () < minPoint (2 )) minPoint (2 ) = m_lines[i].p2 .getZ ();
198- }
199- Vector3f sceneDiagonal;
200-
201- // Center the scene on the center of the point cloud
202- m_sceneCenter = Point3Df ((minPoint (0 ) + maxPoint (0 )) / 2 .0f , -(minPoint (1 ) + maxPoint (1 )) / 2 .0f , -(minPoint (2 ) + maxPoint (2 )) / 2 .0f );
203-
204- // Add the camera to the box of the scene
205- if (m_cameraPose (0 , 3 ) > maxPoint (0 )) maxPoint (0 ) = m_cameraPose (0 , 3 );
206- if (m_cameraPose (1 , 3 ) > maxPoint (1 )) maxPoint (1 ) = m_cameraPose (1 , 3 );
207- if (m_cameraPose (2 , 3 ) > maxPoint (2 )) maxPoint (2 ) = m_cameraPose (2 , 3 );
208- if (m_cameraPose (0 , 3 ) < minPoint (0 )) minPoint (0 ) = m_cameraPose (0 , 3 );
209- if (m_cameraPose (1 , 3 ) < minPoint (1 )) minPoint (1 ) = m_cameraPose (1 , 3 );
210- if (m_cameraPose (2 , 3 ) < minPoint (2 )) minPoint (2 ) = m_cameraPose (2 , 3 );
211-
212- // Copmute the diagonal of the box to define the scene Size
213- sceneDiagonal (0 ) = maxPoint (0 ) - minPoint (0 );
214- sceneDiagonal (1 ) = maxPoint (1 ) - minPoint (1 );
215- sceneDiagonal (2 ) = maxPoint (2 ) - minPoint (2 );
216- m_sceneSize = sceneDiagonal.norm ();
217-
218- // Set the camera according to the center and the size of the scene.
219- m_glcamera.resetview (math_vector_3f (m_sceneCenter.getX (), m_sceneCenter.getY (), m_sceneCenter.getY ()), m_sceneSize);
220-
221- m_firstDisplay = false ;
222- }
223- if (m_exitKeyPressed)
224- {
225- m_glcamera.clear (0.0 , 0.0 , 0.0 , 1.0 );
226- glutDestroyWindow (m_glWindowID);
227- return FrameworkReturnCode::_STOP;
228- }
229-
230- glutMainLoopEvent ();
231- return FrameworkReturnCode::_SUCCESS;
232- }
233-
234168void drawFrustumCamera (Transform3Df& pose,
235169 std::vector<unsigned int >& color,
236170 float scale,
@@ -402,22 +336,6 @@ void SolAR3DPointsViewerOpengl::OnRender()
402336 glPopMatrix ();
403337 }
404338
405- if (!m_lines.empty ())
406- {
407- glPushMatrix ();
408- glEnable (GL_LINE_SMOOTH);
409- glBegin (GL_LINES);
410- for (unsigned int i = 0 ; i < m_lines.size (); ++i) {
411-
412- glColor3f (m_pointsColor[0 ], m_pointsColor[1 ], m_pointsColor[2 ]);
413-
414- glVertex3f (m_lines[i].p1 .getX (), -m_lines[i].p1 .getY (), -m_lines[i].p1 .getZ ());
415- glVertex3f (m_lines[i].p2 .getX (), -m_lines[i].p2 .getY (), -m_lines[i].p2 .getZ ());
416- }
417- glEnd ();
418- glPopMatrix ();
419- }
420-
421339 // draw camera pose !
422340 std::vector<Vector4f> cameraPyramid;
423341 drawFrustumCamera (m_cameraPose, m_cameraColor, 0 .033f * m_cameraScale * m_sceneSize, 0 .003f * m_cameraScale * m_sceneSize, true );
0 commit comments