00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <cstdlib>
00021 #include "uvsim/visualization/Frame.h"
00022 #include "uvsim/visualization/PointCloud.h"
00023 #include "uvsim/visualization/SimpleViewer.h"
00024 #include "uvsim/visualization/Ellipsoid.h"
00025 #include "uvsim/utilities/utilities.h"
00026
00027 using namespace uvsim;
00028
00029 int main (int argc, char const* argv[])
00030 {
00031
00032 int maxN = 10000;
00033 int freqLoop = 10;
00034 int fps = 10;
00035 int spriteSize = 3;
00036 double manipDistance = 100;
00037 float frameSize =5;
00038
00039
00040 srand(time(0));
00041
00042
00043 osg::Vec3Array *points = new osg::Vec3Array;
00044 osg::Vec4Array *colors = new osg::Vec4Array;
00045 osg::Vec4 ini(1,1,0,1);
00046 osg::Vec4 fin(0,0,1,1);
00047 PointCloud *pointCloud = new PointCloud(spriteSize,points,colors);
00048
00049 osg::Group *root = new osg::Group;
00050 root->addChild(pointCloud->root.get());
00051
00052 Ellipsoid ellipsoid(osg::Vec3d(20,10,1),osg::Vec3d(2,2,2));
00053 root->addChild(ellipsoid.pointCloud->root.get());
00054
00055
00056 osg::Vec3d manipCenter(0,0,0);
00057 double fogStart=0, fogEnd=1000;
00058 SimpleViewer simpleViewer(0,20,root,manipDistance,manipCenter,frameSize,fogStart,fogEnd);
00059 simpleViewer.start();
00060
00061
00062 for (int j=0;!simpleViewer.viewer->done();j++)
00063 {
00064
00065 usleep(1e6/freqLoop);
00066
00067
00068 clear();
00069 std::cout << (100.*(j+1))/maxN << "% Complete" << std::endl;
00070
00071
00072 double x = 10*(rand()/float(RAND_MAX)-0.5);
00073 double y = 10*(rand()/float(RAND_MAX)-0.5);
00074 double z = 10*(rand()/float(RAND_MAX)-0.5);
00075
00076
00077 points->push_back(osg::Vec3(x,y,z));
00078 colors->push_back(ini+(fin-ini)*(j*2/(float)maxN));
00079 pointCloud->updateSize();
00080 }
00081
00082 simpleViewer.join();
00083 return 0;
00084 }
00085
00086