Commit c227798f authored by Pierre Kraemer's avatar Pierre Kraemer

SocialAgents -> suite simplif faces

parent 059b23c9
......@@ -20,7 +20,7 @@ Simulator::Simulator() : agents_(), defaultAgent_(0), globalTime_(0.0f), timeSte
// CGoGN::CityGenerator::generateToboggan<PFP>(envMap.map,envMap.position,envMap.closeMark,100,0.25,200,10);
// std::cout << "simplify" << std::endl;
envMap.simplify();
// envMap.simplify();
envMap.map.init();
std::cout << "setup scenario" << std::endl;
setupScenario();
......
......@@ -552,23 +552,6 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
break ;
}
case 'v':
{
srand(time(NULL)) ;
unsigned int nbDarts = myMap.getNbDarts() ;
unsigned int r = rand() % nbDarts ;
Dart d(r) ;
if(myMap.isDartValid(d))
{
myMap.deleteVertex(d) ;
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ;
}
glutPostRedisplay() ;
break ;
}
case 'x':
{
Algo::Export::exportOFF<PFP>(myMap, position, "export.off") ;
......
......@@ -146,6 +146,15 @@ void coarsenEdge(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(map.edgeCanBeCoarsened(d) || !"Trying to coarsen an edge that can not be coarsened") ;
unsigned int cur = map.getCurrentLevel() ;
Dart d2 = map.phi2(d) ;
map.setCurrentLevel(cur + 1) ;
map.unsewFaces(d) ;
map.unsewFaces(d2) ;
map.collapseEdge(map.phi1(d)) ;
map.collapseEdge(map.phi1(d2)) ;
map.sewFaces(d, d2) ;
map.setCurrentLevel(cur) ;
}
template <typename PFP>
......@@ -155,13 +164,14 @@ void coarsenFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
assert(map.faceIsSubdividedOnce(d) || !"Trying to coarsen a non-subdivided face or a more than once subdivided face") ;
unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(cur + 1) ;
map.deleteVertex(map.phi1(map.phi1(d))) ;
map.setCurrentLevel(cur) ;
Dart fit = d ;
do
{
map.setCurrentLevel(cur + 1) ;
map.deleteVertex(map.phi1(map.phi1(fit))) ;
map.setCurrentLevel(cur) ;
if(map.edgeCanBeCoarsened(fit))
coarsenEdge<PFP>(map, fit, position) ;
fit = map.phi1(fit) ;
} while(fit != d) ;
}
......
......@@ -200,8 +200,8 @@ bool ImplicitHierarchicalMap::faceIsSubdividedOnce(Dart d)
{
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
unsigned int fLevel = faceLevel(d) ;
if(fLevel < m_curLevel)
return false ;
if(fLevel < m_curLevel) // a face whose level in the current level map is lower than
return false ; // the current level can not be subdivided to higher levels
unsigned int degree = 0 ;
bool subd = false ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment