Go to the documentation of this file.00001 #include <stdlib.h>
00002 #include <iostream>
00003 #include <assert.h>
00004 #include <ndt_visualisation/NDTVizGlut.hh>
00005
00006 using namespace std;
00007
00008 int main(int argc, char *argv[])
00009 {
00010 std::cout << "test program" << std::endl;
00011
00012 NDTVizGlut glut3d;
00013 glut3d.win_run(&argc, argv);
00014 {
00015 NDTVizGlutEllipsoid* el = new NDTVizGlutEllipsoid(1., 1., false, 40);
00016 el->setPos(Eigen::Vector3d(1., 1., 1.));
00017 Eigen::Matrix3d cov = Eigen::Matrix3d::Zero(3,3);
00018 cov(0,0) = 1.;
00019 cov(1,1) = 1.5;
00020 cov(2,2) = 0.5;
00021 el->setCov(cov);
00022 glut3d.addObject(el);
00023 }
00024
00025 {
00026 NDTVizGlutEllipsoid* el = new NDTVizGlutEllipsoid(1., 1., true, 40);
00027 el->setPos(Eigen::Vector3d(4., 3., 1.));
00028 Eigen::Matrix3d cov = Eigen::Matrix3d::Zero(3,3);
00029 cov(0,0) = 0.1;
00030 cov(1,1) = 0.5;
00031 cov(2,2) = 0.001;
00032 el->setCov(cov);
00033 glut3d.addObject(el);
00034 }
00035
00036 NDTVizGlutPointCloudColor pts;
00037 NDTVizGlutSetOfLines lines;
00038 for (size_t i = 0; i < 1000; i++) {
00039 pts.push_back(i*0.01, 2*sin(i*0.01), cos(i*0.002), i*0.001, 1, 1.);
00040 lines.push_back(-i*0.01, 2*sin(i*0.01), cos(i*0.002), i*0.001, 1, 1.);
00041 }
00042 lines.push_back(0, 0, 0, 1, 1, 1);
00043 lines.push_back(2, 2, 2, 3, 3, 3);
00044
00045 glut3d.addObject(&pts);
00046 glut3d.addObject(&lines);
00047 int counter = 0;
00048 while(true)
00049 {
00050 {
00051 glut3d.process_events();
00052
00053 usleep(1000);
00054 for (size_t i = 0; i < 1000; i++) {
00055 pts.getPoint(i).pos[1] = sin(counter*0.001);
00056 }
00057 glut3d.repaint();
00058 }
00059 counter++;
00060 }
00061 exit(1);
00062 }
00063