int main(int argc, char** argv)
{        
	//Generate map foundation
	short int map[MAPSIZE][MAPSIZE];
	int branch_chance = 50;
	initMap(map);
	createMainPath(map);
	createBranches(map, branch_chance);
	printMap(map);
	system("pause");
	/* Standard GLUT initialization */
	//glutInit(&argc,argv);
	/*glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(700,700);
    glutInitWindowPosition(50,50);
    glutCreateWindow("War Games Scene");
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
	glutKeyboardFunc(myKey);*/






	//myinit();
	//glutMainLoop(); /* enter event loop */
}
Example #2
0
void Centerline::importFile(std::string fileName)
{
  current = GModel::current();
  std::vector<GFace*> currentFaces(current->firstFace(), current->lastFace());
  for (unsigned int i = 0; i < currentFaces.size(); i++){
    GFace *gf = currentFaces[i];
     if (gf->geomType() == GEntity::DiscreteSurface){
     	for(unsigned int j = 0; j < gf->triangles.size(); j++)
     	  triangles.push_back(gf->triangles[j]);
	if (is_cut){
	  gf->triangles.clear();
	  gf->deleteVertexArrays();
	  current->remove(gf);
	}
     }
  }

  if(triangles.empty()){
    Msg::Error("Current GModel has no triangles ...");
    return;
  }

  mod = new GModel();
  mod->load(fileName);
  mod->removeDuplicateMeshVertices(1.e-8);
  current->setAsCurrent();
  current->setVisibility(1);

  int maxN = 0.0;
  std::vector<GEdge*> modEdges(mod->firstEdge(), mod->lastEdge());
  MVertex *vin = modEdges[0]->lines[0]->getVertex(0);
  ptin = SPoint3(vin->x(), vin->y(), vin->z());
  for (unsigned int i = 0; i < modEdges.size(); i++){
    GEdge *ge = modEdges[i];
    for(unsigned int j = 0; j < ge->lines.size(); j++){
      MLine *l = ge->lines[j];
      MVertex *v0 = l->getVertex(0);
      MVertex *v1 = l->getVertex(1);
      std::map<MVertex*, int>::iterator it0 = colorp.find(v0);
      std::map<MVertex*, int>::iterator it1 = colorp.find(v1);
      if (it0 == colorp.end() || it1 == colorp.end()){
	lines.push_back(l);
	colorl.insert(std::make_pair(l, ge->tag()));
	maxN = std::max(maxN, ge->tag());
       }
      if (it0 == colorp.end()) colorp.insert(std::make_pair(v0, ge->tag()));
      if (it1 == colorp.end()) colorp.insert(std::make_pair(v1, ge->tag()));
    }
 }

  createBranches(maxN);
}
Example #3
0
void LjmetEventContent::Fill(){
  if (mFirstEntry){
    createBranches();
    mFirstEntry = false;
  }
  mpTree->Fill();


  // fill histograms
  // create histograms
  std::map<std::string,std::map<std::string,LjmetEventContent::HistMetadata> >::iterator iMod;
  std::map<std::string,LjmetEventContent::HistMetadata>::iterator iHist;
  for (iMod=mDoubleHist.begin();iMod!=mDoubleHist.end();++iMod){
    for (iHist=iMod->second.begin();iHist!=iMod->second.end();++iHist){
      TH1 * _hist = iHist->second.GetHist();
      if (_hist) _hist->Fill(iHist->second.GetValue());
    }
  }


  return;
}