Commit b1c5cdc3 authored by CGoGN GIT Supervisor's avatar CGoGN GIT Supervisor
Browse files

Merge branch 'master' of /home/untereiner/CGoGN

* 'master' of /home/untereiner/CGoGN:
  ajout d'une methode cointains dans bouding box + modifs subdiv volume
parents d1df0aeb 79d29457
...@@ -85,9 +85,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position ...@@ -85,9 +85,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
++degree; ++degree;
p += position[it] ; p += position[it] ;
if(!map.edgeIsSubdivided(it)) // first cut the edges (if they are not already) if(!map.edgeIsSubdivided(it)) // first cut the edges (if they are not already)
{
Algo::IHM::subdivideEdge<PFP>(map, it, position) ; // and compute the degree of the face Algo::IHM::subdivideEdge<PFP>(map, it, position) ; // and compute the degree of the face
}
it = map.phi1(it) ; it = map.phi1(it) ;
} while(it != old) ; } while(it != old) ;
p /= typename PFP::REAL(degree) ; p /= typename PFP::REAL(degree) ;
...@@ -96,38 +94,38 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position ...@@ -96,38 +94,38 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
Dart res; Dart res;
// if(degree == 3 && sType == S_TRI) //subdiviser une face triangulaire if(degree == 3 && sType == S_TRI) //subdiviser une face triangulaire
// { {
// 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, EDGE) ; // set the edge id of the inserted edge to the next available id 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); unsigned int idface = map.getFaceId(old);
// map.setFaceId(dd, idface, FACE) ; map.setFaceId(dd, idface, FACE) ;
// map.setFaceId(e, idface, FACE) ; map.setFaceId(e, idface, FACE) ;
//
// 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, EDGE) ; map.setEdgeId(map.phi_1(dd), id, EDGE) ;
//
// map.setFaceId(dd, idface, FACE) ; map.setFaceId(dd, idface, FACE) ;
// map.setFaceId(e, idface, FACE) ; map.setFaceId(e, idface, FACE) ;
//
// 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, EDGE) ; map.setEdgeId(map.phi_1(dd), id, EDGE) ;
//
// map.setFaceId(dd, idface, FACE) ; map.setFaceId(dd, idface, FACE) ;
// map.setFaceId(e, idface, FACE) ; map.setFaceId(e, idface, FACE) ;
// } }
// else else
// { {
Dart dd = map.phi1(old) ; Dart dd = map.phi1(old) ;
map.splitFace(dd, map.phi1(map.phi1(dd))) ; map.splitFace(dd, map.phi1(map.phi1(dd))) ;
...@@ -164,7 +162,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position ...@@ -164,7 +162,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
dd = map.phi2(map.phi1(dd)); dd = map.phi2(map.phi1(dd));
} }
while(dd != ne); while(dd != ne);
// } }
map.setCurrentLevel(cur) ; map.setCurrentLevel(cur) ;
} }
...@@ -182,8 +180,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -182,8 +180,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
map.setCurrentLevel(vLevel); map.setCurrentLevel(vLevel);
std::cout << "vLevel = " << vLevel << std::endl;
/* /*
* au niveau du volume courant i * au niveau du volume courant i
* stockage d'un brin de chaque face de celui-ci * stockage d'un brin de chaque face de celui-ci
...@@ -191,7 +187,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -191,7 +187,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
*/ */
DartMarkerStore mf(map); // Lock a face marker to save one dart per face DartMarkerStore mf(map); // Lock a face marker to save one dart per face
//DartMarkerStore mv(map); // Lock a vertex marker to compute volume center
CellMarker mv(map, VERTEX); CellMarker mv(map, VERTEX);
typename PFP::VEC3 volCenter; typename PFP::VEC3 volCenter;
...@@ -217,7 +212,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -217,7 +212,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
//compute volume centroid //compute volume centroid
if(!mv.isMarked(e)) if(!mv.isMarked(e))
{ {
//mv.markOrbit(VERTEX, e);
mv.mark(e); mv.mark(e);
volCenter += position[e]; volCenter += position[e];
++count; ++count;
...@@ -246,7 +240,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -246,7 +240,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
std::vector<std::pair<Dart,Dart> > subdividedfaces; std::vector<std::pair<Dart,Dart> > subdividedfaces;
subdividedfaces.reserve(25); subdividedfaces.reserve(25);
int i = 0;
//First step : subdivide edges and faces //First step : subdivide edges and faces
//creates a i+1 edge level and i+1 face level //creates a i+1 edge level and i+1 face level
for (std::vector<Dart>::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face) for (std::vector<Dart>::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
...@@ -255,24 +248,12 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -255,24 +248,12 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
//if needed subdivide face //if needed subdivide face
if(!map.faceIsSubdivided(d)) if(!map.faceIsSubdivided(d))
{
++i;
Algo::IHM::subdivideFace<PFP>(map, d, position); Algo::IHM::subdivideFace<PFP>(map, d, position);
}
std::cout << "CHECK FACES " << std::endl;
map.check();
//save a dart from the subdivided face //save a dart from the subdivided face
unsigned int cur = map.getCurrentLevel() ; unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(map.getMaxLevel()); unsigned int fLevel = map.faceLevel(d) + 1; //puisque dans tous les cas, la face est subdivisee
Dart old = map.faceOldestDart(d);
std::cout << " Oldest dart Face = " << old << std::endl;
unsigned int fLevel = map.faceLevel(old); //puisque dans tous les cas, la face est subdivisee
std::cout << "FACE LEVEL = " << fLevel << std::endl;
map.setCurrentLevel(fLevel) ; map.setCurrentLevel(fLevel) ;
...@@ -288,8 +269,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -288,8 +269,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
map.setCurrentLevel(cur); map.setCurrentLevel(cur);
} }
map.setCurrentLevel(vLevel + 1) ; // go to the next level to perform volume subdivision map.setCurrentLevel(vLevel + 1) ; // go to the next level to perform volume subdivision
std::vector<Dart> newEdges; //save darts from inner edges std::vector<Dart> newEdges; //save darts from inner edges
...@@ -301,33 +280,21 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -301,33 +280,21 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
Dart e = *edge; Dart e = *edge;
Dart f1 = map.phi1(*edge); Dart f1 = map.phi1(*edge);
int i = 0;
do do
{ {
std::cout << "corner #" << i << " degree = " << map.faceDegree(e) << std::endl; map.unsewFaces(map.phi1(map.phi1(e)));
if(map.phi2(map.phi1(map.phi1(e))) != map.phi1(map.phi1(e)))
map.unsewFaces(map.phi1(map.phi1(e)));
//TODO utile ? //TODO utile ?
if(map.phi2(map.phi1(e)) != map.phi1(e)) //if(map.phi2(map.phi1(e)) != map.phi1(e))
map.unsewFaces(map.phi1(e)); map.unsewFaces(map.phi1(e));
++i;
e = map.phi2(map.phi_1(e)); e = map.phi2(map.phi_1(e));
} }
while(e != *edge); while(e != *edge);
map.closeHole(f1); map.closeHole(f1);
std::cout << "CHECK CLOSE HOLE " << std::endl;
map.check();
std::cout << "corner degree = " << i << std::endl;
std::cout << "face degree = " << map.faceDegree(map.phi2(f1)) << std::endl;
// if(map.faceDegree(map.phi2(f1)) > 6)
// return Dart::nil();
Dart old = map.phi2(map.phi1(e)); Dart old = map.phi2(map.phi1(e));
Dart dd = map.phi1(map.phi1(old)) ; Dart dd = map.phi1(map.phi1(old)) ;
map.splitFace(old,dd) ; map.splitFace(old,dd) ;
...@@ -395,8 +362,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -395,8 +362,6 @@ Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
map.setCurrentLevel(cur) ; map.setCurrentLevel(cur) ;
std::cout << std::endl;
return subdividedfaces.begin()->first; return subdividedfaces.begin()->first;
} }
......
...@@ -86,6 +86,12 @@ class BoundingBox ...@@ -86,6 +86,12 @@ class BoundingBox
// fusion with the given bounding box // fusion with the given bounding box
void fusion(const BoundingBox<VEC>& bb) ; void fusion(const BoundingBox<VEC>& bb) ;
//return true if the vector belongs strictly to a bounding box
bool contains(const VEC& p);
//return true if the bounding box belongs strictly to a bounding box
bool contains(const BoundingBox<VEC> & bb);
/**********************************************/ /**********************************************/
/* STREAM OPERATORS */ /* STREAM OPERATORS */
/**********************************************/ /**********************************************/
......
...@@ -178,6 +178,30 @@ void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb) ...@@ -178,6 +178,30 @@ void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb)
} }
} }
template <typename VEC>
bool BoundingBox<VEC>::contains(const VEC& p)
{
for(unsigned int i = 0; i < m_pMin.dimension(); ++i)
{
if(m_pMin[i] > p[i])
return false ;
if(p[i] > m_pMax[i])
return false ;
}
return true;
}
template <typename VEC>
bool BoundingBox<VEC>::contains(const BoundingBox<VEC>& bb)
{
return this->contains(bb.min()) && this->contains(bb.max());
}
//template <typename VEC> //template <typename VEC>
//friend std::ostream& BoundingBox<VEC>::operator<<(std::ostream& out, const BoundingBox<VEC>& bb) //friend std::ostream& BoundingBox<VEC>::operator<<(std::ostream& out, const BoundingBox<VEC>& bb)
//{ //{
......
...@@ -1204,6 +1204,7 @@ bool Map3::check() ...@@ -1204,6 +1204,7 @@ bool Map3::check()
{ {
if (!m.isMarked(d)) // phi1 a au moins un antécédent ? if (!m.isMarked(d)) // phi1 a au moins un antécédent ?
{ {
std::cout << "dart = " << d << std::endl;
CGoGNout << "Check: dart with no phi1 predecessor" << CGoGNendl; CGoGNout << "Check: dart with no phi1 predecessor" << CGoGNendl;
return false; return 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