void plotMain(int argc, char ** argv, unsigned char * dataSet, int imageWidth, int imageHeight, int imageDepth)
{
    glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(1000, 1000);
	glutInitWindowPosition (0, 0);
	glutCreateWindow("Data Visualiser");
    
    Init();
    
    StoreDataSet(dataSet, imageWidth, imageHeight, imageDepth);
    
    vertices = runMarchingCubes(voxels, __imageWidth, __imageWidth, __imageDepth, 1, 1, 1, 0.5); //was 32.0f
    // here our scalar field holds the quaternion lengths after all iteration is complete
    //for(each element value in the scalar field){	
    // truncate all final quaternion lengths so that there is a maximum	
        //if(element value > 2*threshold)		
            //element value = 2*threshold;	
            // normalize all lengths to be within the interval 0.0 through 1.0	
            //element value /= 2*p.threshold;	
            // reverse the values so that lengths which were initially greater than 0.5 are now outside of the mesh	// not doing so would result in the same mesh, but the surface normals would point inward (a bad thing)	
            //element value = 1.0 - element value;}
//    vector<vertex>::iterator it;
//    for(it = vertices.begin(); it < vertices.end(); it++) {
//        for (int j  = 0; j < 3; j++) {
//            
//        }
//        glNormal3d(it->normal_x, it->normal_y, it->normal_z);
//        //scaling factor for z
//        glVertex3d(it->x, it->y, it->z);
//    }
//    initialize each vertex normal to the zero vector
//    for each triangle
//        add triangle normal to the vertex normal for each of the triangle's vertices
//            normalize each vertex normal
//            

    glutMouseFunc(&MouseClick);
    glutKeyboardFunc(Input);
	glutDisplayFunc(Display);
	glutIdleFunc(Update);
    DisplayUsability();
	glutMainLoop();
}
Exemplo n.º 2
0
template <typename PointT> typename pcl::gpu::kinfuLS::StandaloneMarchingCubes<PointT>::MeshPtr
pcl::gpu::kinfuLS::StandaloneMarchingCubes<PointT>::getMeshFromTSDFCloud (const PointCloud &cloud)
{

  //Clearing TSDF GPU and cPU
  std::cout << "VOLUME SIZE IS " << volume_size_ << std::endl;

  //Clear values in TSDF Volume GPU
  tsdf_volume_gpu_->reset (); // This one uses the same tsdf volume but clears it before loading new values. This one is our friend.

  //Clear values in TSDF Volume CPU
  fill (tsdf_volume_cpu_.begin (), tsdf_volume_cpu_.end (), 0);
   
  //Loading values to GPU
  loadTsdfCloudToGPU (cloud);

  //Creating and returning mesh
  return ( runMarchingCubes () );
 
}