Commit 4f040f66 authored by untereiner's avatar untereiner
Browse files

subdiv

parent 79dbf523
...@@ -403,8 +403,6 @@ void coarsenEdge(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP:: ...@@ -403,8 +403,6 @@ void coarsenEdge(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP::
assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ; 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") ; assert(map.edgeCanBeCoarsened(d) || !"Trying to coarsen an edge that can not be coarsened") ;
std::cout << "coarsenEdge" << std::endl;
unsigned int cur = map.getCurrentLevel() ; unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(cur + 1) ; map.setCurrentLevel(cur + 1) ;
map.uncutEdge(d) ; map.uncutEdge(d) ;
......
...@@ -95,17 +95,24 @@ template <typename PFP> ...@@ -95,17 +95,24 @@ template <typename PFP>
void tetrahedrizeVolume(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position) void tetrahedrizeVolume(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
{ {
//mark bad edges //mark bad edges
DartMarker mBadEdge(map); DartMarkerStore mBadEdge(map);
std::vector<Dart> vEdge;
vEdge.reserve(1024);
// unsignzed int i = 0; // unsignzed int i = 0;
DartMarkerStore mEdge(map); unsigned int nbEdges = map.template getNbOrbits<EDGE>();
unsigned int i = 0;
for(Dart dit = map.begin() ; dit != map.end() ; map.next(dit)) for(Dart dit = map.begin() ; dit != map.end() ; map.next(dit))
{ {
//check if this edge is an "ear-edge" //check if this edge is an "ear-edge"
if(!mBadEdge.isMarked(dit)) if(!mBadEdge.isMarked(dit))
{ {
++i;
std::cout << i << " / " << nbEdges << std::endl;
//search three positions //search three positions
typename PFP::VEC3 tris1[3]; typename PFP::VEC3 tris1[3];
tris1[0] = position[dit]; tris1[0] = position[dit];
...@@ -139,7 +146,7 @@ void tetrahedrizeVolume(typename PFP::MAP& map, VertexAttribute<typename PFP::VE ...@@ -139,7 +146,7 @@ void tetrahedrizeVolume(typename PFP::MAP& map, VertexAttribute<typename PFP::VE
} }
} }
std::cout << "intersection ? " << (intersection ? "true" : "false") << std::endl; //std::cout << "intersection ? " << (intersection ? "true" : "false") << std::endl;
if(intersection) if(intersection)
{ {
...@@ -147,23 +154,10 @@ void tetrahedrizeVolume(typename PFP::MAP& map, VertexAttribute<typename PFP::VE ...@@ -147,23 +154,10 @@ void tetrahedrizeVolume(typename PFP::MAP& map, VertexAttribute<typename PFP::VE
} }
else //cut a tetrahedron else //cut a tetrahedron
{ {
std::cout << "cut cut " << std::endl; vEdge.push_back(dit);
Dart dring = map.phi_1(dit);
std::vector<Dart> vPath;
vPath.push_back(map.phi_1(dring));
vPath.push_back(map.phi1(map.phi2(dring)));
vPath.push_back(map.phi_1(map.phi2(dring)));
vPath.push_back(map.phi1(dring));
map.splitVolume(vPath);
map.splitFace(map.phi2(map.phi1(dring)), map.phi2(map.phi1(map.phi2(dring))));
return;
} }
// ++i;
// //
// if(i == 16) // if(i == 16)
// return; // return;
...@@ -171,6 +165,28 @@ void tetrahedrizeVolume(typename PFP::MAP& map, VertexAttribute<typename PFP::VE ...@@ -171,6 +165,28 @@ void tetrahedrizeVolume(typename PFP::MAP& map, VertexAttribute<typename PFP::VE
} }
} }
std::cout << "nb edges to split = " << vEdge.size() << std::endl;
i = 0;
for(std::vector<Dart>::iterator it = vEdge.begin() ; it != vEdge.end() ; ++it)
{
++i;
std::cout << i << " / " << vEdge.size() << std::endl;
Dart dit = *it;
//std::cout << "cut cut " << std::endl;
std::vector<Dart> vPath;
vPath.push_back(map.phi1(dit));
vPath.push_back(map.phi1(map.phi2(map.phi_1(dit))));
vPath.push_back(map.phi_1(map.phi2(dit)));
map.splitVolume(vPath);
map.splitFace(map.phi2(map.phi1(dit)), map.phi2(map.phi1(map.phi2(dit))));
}
std::cout << "finished " << std::endl;
} }
......
...@@ -803,9 +803,6 @@ bool ImplicitHierarchicalMap3::edgeCanBeCoarsened(Dart d) ...@@ -803,9 +803,6 @@ bool ImplicitHierarchicalMap3::edgeCanBeCoarsened(Dart d)
Dart d2 = phi2(d) ; Dart d2 = phi2(d) ;
++m_curLevel ; ++m_curLevel ;
std::cout << "vertex degree(phi1(d)) = " << vertexDegree(phi1(d)) << std::endl;
std::cout << "vertex degree(d) = " << vertexDegree(d) << std::endl;
if(vertexDegree(phi1(d)) == 2) if(vertexDegree(phi1(d)) == 2)
{ {
degree2 = true ; degree2 = true ;
......
Supports Markdown
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