Commit c403f8c1 authored by untereiner's avatar untereiner

some changes

parent 4d46728d
......@@ -41,7 +41,7 @@ template <typename PFP>
void subdivideEdge(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position) ;
template <typename PFP>
void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position) ;
void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position, bool forceTri = true);
template <typename PFP>
void coarsenEdge(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position) ;
......
......@@ -61,7 +61,7 @@ void subdivideEdge(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
}
template <typename PFP>
void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position)
void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position, bool forceTri)
{
assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(!map.faceIsSubdivided(d) || !"Trying to subdivide an already subdivided face") ;
......@@ -89,7 +89,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
map.setCurrentLevel(fLevel + 1) ; // go to the next level to perform face subdivision
if(degree == 3) // if subdividing a triangle
if(degree == 3 && forceTri) // if subdividing a triangle
{
Dart dd = map.phi1(old) ;
Dart e = map.phi1(map.phi1(dd)) ;
......@@ -134,17 +134,16 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
}
else if(t == 2)
{
if(dId == eId)
{
std::cout << "plop" << std::endl;
map.setEdgeId(dit, 0);
map.setEdgeId(map.phi2(dit), 0);
}
else
{
map.setEdgeId(dit, 1);
map.setEdgeId(map.phi2(dit), 1);
}
if(dId == eId)
{
map.setEdgeId(dit, 0);
map.setEdgeId(map.phi2(dit), 0);
}
else
{
map.setEdgeId(dit, 1);
map.setEdgeId(map.phi2(dit), 1);
}
}
else if(t == 3)
{
......
......@@ -121,8 +121,8 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
Dart dd = map.phi1(old) ;
Dart e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ; // insert a new edge
unsigned int id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id, EDGE) ; // set the edge id of the inserted edge to the next available id
//unsigned int id = map.getNewEdgeId() ;
//map.setEdgeId(map.phi_1(dd), id, EDGE) ; // set the edge id of the inserted edge to the next available id
unsigned int idface = map.getFaceId(old);
map.setFaceId(dd, idface, FACE) ;
......@@ -131,8 +131,8 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
dd = e ;
e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ;
id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id, EDGE) ;
//id = map.getNewEdgeId() ;
//map.setEdgeId(map.phi_1(dd), id, EDGE) ;
map.setFaceId(dd, idface, FACE) ;
map.setFaceId(e, idface, FACE) ;
......@@ -140,11 +140,53 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
dd = e ;
e = map.phi1(map.phi1(dd)) ;
map.splitFace(dd, e) ;
id = map.getNewEdgeId() ;
map.setEdgeId(map.phi_1(dd), id, EDGE) ;
//id = map.getNewEdgeId() ;
//map.setEdgeId(map.phi_1(dd), id, EDGE) ;
map.setFaceId(dd, idface, FACE) ;
map.setFaceId(e, idface, FACE) ;
Dart stop = map.phi2(map.phi1(old));
Dart dit = stop;
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 == 0)
{
map.setEdgeId(dit, 1, EDGE) ;
map.setEdgeId(map.phi2(dit), 1, EDGE) ;
}
else if(t == 1)
{
map.setEdgeId(dit, 2, EDGE) ;
map.setEdgeId(map.phi2(dit), 2, EDGE) ;
}
else if(t == 2)
{
if(dId == eId)
{
map.setEdgeId(dit, 0, EDGE) ;
map.setEdgeId(map.phi2(dit), 0, EDGE) ;
}
else
{
map.setEdgeId(dit, 1, EDGE) ;
map.setEdgeId(map.phi2(dit), 1, EDGE) ;
}
}
else if(t == 3)
{
map.setEdgeId(dit, 0, EDGE) ;
map.setEdgeId(map.phi2(dit), 0, EDGE) ;
}
dit = map.phi1(dit);
}while(dit != stop);
}
else
{
......
......@@ -69,10 +69,9 @@ void ImplicitHierarchicalMap::initImplicitProperties()
//initEdgeId() ;
//init each edge Id at 0
TraversorE<ImplicitHierarchicalMap> te(*this);
for(Dart dit = te.begin() ; dit != te.next() ; dit = te.next())
for(Dart d = Map2::begin(); d != Map2::end(); Map2::next(d))
{
m_edgeId[dit] = 0;
m_edgeId[d] = 0;
}
for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
......
......@@ -72,8 +72,15 @@ void ImplicitHierarchicalMap3::clear(bool removeAttrib)
void ImplicitHierarchicalMap3::initImplicitProperties()
{
initEdgeId() ;
initFaceId();
//initEdgeId() ;
//initFaceId();
for(Dart d = Map3::begin(); d != Map3::end(); Map3::next(d))
{
m_edgeId[d] = 0;
m_faceId[d] = 0;
}
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