Commit ce12a6a6 authored by Lionel Untereiner's avatar Lionel Untereiner

changes to IHM2 ... compact indices

parent b82bd2ed
...@@ -92,38 +92,64 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP: ...@@ -92,38 +92,64 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
Dart dd = map.phi1(old) ; Dart dd = map.phi1(old) ;
Dart e = map.phi1(map.phi1(dd)) ; Dart e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ; // insert a new edge map.splitFace(dd, e) ; // insert a new edge
unsigned int id = map.getNewEdgeId() ; //unsigned int id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id) ; // set the edge id of the inserted //map.setEdgeId(map.phi_1(dd), id) ; // set the edge id of the inserted
map.setEdgeId(map.phi_1(e), id) ; // edge to the next available id //map.setEdgeId(map.phi_1(e), id) ; // edge to the next available id
dd = e ; dd = e ;
e = map.phi1(map.phi1(dd)) ; e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ; map.splitFace(dd, e) ;
id = map.getNewEdgeId() ; //id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id) ; //map.setEdgeId(map.phi_1(dd), id) ;
map.setEdgeId(map.phi_1(e), id) ; //map.setEdgeId(map.phi_1(e), id) ;
dd = e ; dd = e ;
e = map.phi1(map.phi1(dd)) ; e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ; map.splitFace(dd, e) ;
id = map.getNewEdgeId() ; //id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id) ; //map.setEdgeId(map.phi_1(dd), id) ;
map.setEdgeId(map.phi_1(e), id) ; //map.setEdgeId(map.phi_1(e), id) ;
Dart dit = map.phi2(map.phi_1(dd));
do
{
unsigned int dId = map.getEdgeId(map.phi_1(map.phi2(dit)));
unsigned int eId = map.getEdgeId(map.phi1(map.phi2(dit)));
unsigned int t = dId + eId;
if(t == 1)
{
map.setEdgeId(dit, 2);
}
else if(t == 2)
{
map.setEdgeId(dit, 1);
}
else if(t == 3)
{
map.setEdgeId(dit, 0);
}
dit = map.phi1(dit);
}while(dit != map.phi2(map.phi_1(dd)));
} }
else // if subdividing a polygonal face else // if subdividing a polygonal face
{ {
Dart dd = map.phi1(old) ; Dart dd = map.phi1(old) ;
map.splitFace(dd, map.phi1(map.phi1(dd))) ; // insert a first edge map.splitFace(dd, map.phi1(map.phi1(dd))) ; // insert a first edge
Dart ne = map.alpha1(dd) ; Dart ne = map.alpha1(dd) ;
Dart ne2 = map.phi2(ne) ; //Dart ne2 = map.phi2(ne) ;
map.cutEdge(ne) ; // cut the new edge to insert the central vertex map.cutEdge(ne) ; // cut the new edge to insert the central vertex
unsigned int id = map.getNewEdgeId() ; //unsigned int id = map.getNewEdgeId() ;
map.setEdgeId(ne, id) ; //map.setEdgeId(ne, id) ;
map.setEdgeId(map.phi2(ne), id) ; // set the edge id of the inserted //map.setEdgeId(map.phi2(ne), id) ; // set the edge id of the inserted
id = map.getNewEdgeId() ; //id = map.getNewEdgeId() ;
map.setEdgeId(ne2, id) ; // edges to the next available ids //map.setEdgeId(ne2, id) ; // edges to the next available ids
map.setEdgeId(map.phi2(ne2), id) ; //map.setEdgeId(map.phi2(ne2), id) ;
position[map.phi2(ne)] = p ; position[map.phi2(ne)] = p ;
...@@ -133,11 +159,24 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP: ...@@ -133,11 +159,24 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
Dart next = map.phi1(map.phi1(dd)) ; Dart next = map.phi1(map.phi1(dd)) ;
map.splitFace(map.phi1(ne), dd) ; map.splitFace(map.phi1(ne), dd) ;
Dart nne = map.alpha1(dd) ; Dart nne = map.alpha1(dd) ;
id = map.getNewEdgeId() ; //id = map.getNewEdgeId() ;
map.setEdgeId(nne, id) ; //map.setEdgeId(nne, id) ;
map.setEdgeId(map.phi2(nne), id) ; //map.setEdgeId(map.phi2(nne), id) ;
dd = next ; dd = next ;
} }
Dart dit = map.phi2(ne);
do
{
unsigned int eId = map.getEdgeId(map.phi1(dit));
if(eId == 0)
map.setEdgeId(dit, 1);
else if(eId == 1)
map.setEdgeId(dit, 0);
dit = map.phi2(map.phi_1(ne));
}
while(dit != map.phi2(ne));
} }
map.setCurrentLevel(cur) ; map.setCurrentLevel(cur) ;
......
...@@ -53,7 +53,14 @@ ImplicitHierarchicalMap::~ImplicitHierarchicalMap() ...@@ -53,7 +53,14 @@ ImplicitHierarchicalMap::~ImplicitHierarchicalMap()
void ImplicitHierarchicalMap::init() void ImplicitHierarchicalMap::init()
{ {
initEdgeId() ; //initEdgeId() ;
//init each edge Id at 0
TraversorE<ImplicitHierarchicalMap> te(*this);
for(Dart dit = te.begin() ; dit != te.next() ; dit = te.next())
{
m_edgeId[dit] = 0;
}
for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit) for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
{ {
......
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