Commit f6a8a6a8 authored by untereiner's avatar untereiner

pleins de modifs dans les cartes

parent 53f74df9
......@@ -265,7 +265,7 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
//test si la face est triangulaire ou non
if(map.phi1(map.phi1(map.phi1(d))) == d)
{
std::cout << "trian" << std::endl;
//std::cout << "trian" << std::endl;
Dart cf = map.phi2(map.phi1(d));
Dart e = cf;
do
......@@ -276,7 +276,7 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
}
else
{
std::cout << "quad" << std::endl;
//std::cout << "quad" << std::endl;
Dart cf = map.phi1(d);
Dart e = cf;
do
......@@ -359,7 +359,7 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
//cas de la pyramide
if(dd == stop)
{
std::cout << "pyramide" << std::endl;
//std::cout << "pyramide" << std::endl;
map.splitFace(dd, map.phi1(map.phi1(dd)));
}
else
......@@ -370,7 +370,7 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
if(!( (map.Map2::faceDegree(map.phi_1(stop)) == 3 && map.Map2::faceDegree(map.phi2(map.phi_1(stop))) == 4) ||
(map.Map2::faceDegree(map.phi_1(stop)) == 4 && map.Map2::faceDegree(map.phi2(map.phi_1(stop))) == 3) ))
{
std::cout << "octaedre ou hexaedre" << std::endl;
//std::cout << "octaedre ou hexaedre" << std::endl;
Dart ne = map.phi_1(stop) ;
map.cutEdge(ne);
......@@ -413,7 +413,7 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
}
else
{
std::cout << "prisme" << std::endl;
//std::cout << "prisme" << std::endl;
//tester si besoin de fermer f2 (par exemple pas besoin pour hexa... mais pour tet, octa, prisme oui)
//map.closeHole(f2);
}
......@@ -424,14 +424,14 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
//sinon cas du tetraedre
else
{
std::cout << "tetraedre" << std::endl;
//std::cout << "tetraedre" << std::endl;
//tester si besoin de fermer f2 (par exemple pas besoin pour hexa... mais pour tet, octa, prisme oui)
//map.closeHole(f2);
}
}
std::cout << "1ere etape finished" << std::endl;
//std::cout << "1ere etape finished" << std::endl;
CellMarker mtf(map, FACE);
......@@ -447,7 +447,7 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
map.Map2::faceDegree(map.phi2(map.phi_1(f2))) == 3) && map.Map2::vertexDegree(f2) == 3)
{ //cas du tetrahedre
std::cout << "ajout d'une face" << std::endl;
//std::cout << "ajout d'une face" << std::endl;
if(map.phi3(map.phi2(f2)) == map.phi2(f2))
{
......@@ -470,13 +470,13 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
if(map.Map2::faceDegree(map.phi2(f2)) == 3)
{
std::cout << "ajout d'un tetraedre" << std::endl;
//std::cout << "ajout d'un tetraedre" << std::endl;
Dart x = Algo::Modelisation::trianguleFace<PFP>(map, map.phi2(f1));
position[x] = volCenter;
}
else
{
std::cout << "ajout d'un prisme" << std::endl;
//std::cout << "ajout d'un prisme" << std::endl;
//Dart x = Algo::Modelisation::extrudeFace<PFP>(map,position,map.phi2(f1),5.0);
Dart c = Algo::Modelisation::trianguleFace<PFP>(map, map.phi2(f1));
......@@ -524,7 +524,7 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
}
std::cout << "2e etape finished" << std::endl;
//std::cout << "2e etape finished" << std::endl;
{
......
......@@ -60,6 +60,16 @@ enum { NONE,GRID, CUBE, CYLINDER, CONE, SPHERE, TORE, COMPOSED };
// template <typename PFP>
// Dart triangleFan_topo(typename PFP::MAP& the_map, int n);
/**
* Unsex the Umbrella aroud a vertex, close the hole and then
* create a symetric to construct a polyedron
* @param d a dart from the vertex
*/
template <typename PFP>
void explodPolyhedron(typename PFP::MAP& map, Dart d, typename PFP::TVEC3 position);
/**
* class of geometric Polyhedron
* It alloaw the creation of:
......
......@@ -31,6 +31,92 @@ namespace Algo
namespace Modelisation
{
template <typename PFP>
void explodPolyhedron(typename PFP::MAP& map, Dart d, typename PFP::TVEC3 position)
{
map.unsewVertexUmbrella(d);
unsigned int newFaceDegree = map.closeHole(map.phi1(d));
if(newFaceDegree != 3)
{
//chercher le brin ou demarer
std::multimap<Dart, int> edges ;
typename std::multimap<Dart, int>::iterator it ;
Dart d12 = map.phi2(map.phi1(d));
Dart fit = d12;
int i;
do
{
i = map.faceDegree(map.phi2(fit));
std::cout << "edge(" << fit << "," << i << ")" << std::endl;
edges.insert(std::make_pair(fit, i));
fit = map.phi1(fit);
}
while(fit != d12);
do
{
//44 44
if(edges.find(fit)->second == 4 && edges.find(map.phi1(fit))->second == 4
&& !map.sameFace(map.phi2(fit), map.phi2(map.phi1(fit))))
{
map.splitFace(fit, map.phi1(map.phi1(fit)));
fit = map.phi2(map.phi_1(fit));
int i = map.faceDegree(fit);
edges.insert(std::make_pair(fit, i));
// Dart fit2 = map.phi2(fit) ;
// typename PFP::VEC3 p1 = position[fit] ;
// typename PFP::VEC3 p2 = position[fit2] ;
//
// map.cutEdge(fit) ;
// position[map.phi1(fit)] = typename PFP::REAL(0.5) * (p1 + p2);
std::cout << "flip cas quad quad " << std::endl;
}
//3 3
if(edges.find(fit)->second == 3 && edges.find(map.phi1(fit))->second == 3
&& !map.sameFace(map.phi2(fit), map.phi2(map.phi1(fit))))
{
map.splitFace(fit, map.phi1(fit));
fit = map.phi2(map.phi_1(fit));
int i = map.faceDegree(fit);
edges.insert(std::make_pair(fit, i));
std::cout << "flip cas tri tri" << std::endl;
}
//3 44 ou 44 3
if( ((edges.find(fit)->second == 4 && edges.find(map.phi1(fit))->second == 3)
|| (edges.find(fit)->second == 3 && edges.find(map.phi1(fit))->second == 4))
&& !map.sameFace(map.phi2(fit), map.phi2(map.phi1(fit))))
{
map.splitFace(fit, map.phi1(map.phi1(fit)));
fit = map.phi2(map.phi_1(fit));
int i = map.faceDegree(fit);
edges.insert(std::make_pair(fit, i));
std::cout << "flip cas quad tri" << std::endl;
}
fit = map.phi1(fit);
}
while(map.faceDegree(fit) > 4 && fit != d12);
}
}
template <typename PFP>
Polyhedron<PFP>::Polyhedron(const Polyhedron<PFP>& p1, const Polyhedron<PFP>& p2):
m_map(p1.m_map),
......
......@@ -204,7 +204,7 @@ public:
void embedOrbit(unsigned int orbit, Dart d, unsigned int em) ;
/**
* Associate an new embedding to all darts of a vertex
* Associate an new embedding to all darts of an orbit
* @param orbit orbit to embed
* @param d a dart of the topological cell
* @return index of the attribute in table
......@@ -212,10 +212,10 @@ public:
unsigned int embedNewCell(unsigned int orbit, Dart d) ;
/**
* Copy the cell associated to a dart over an other dart
* Copy the cell associated to a dart over an other dart
* @param orbit attribute orbit to use
* @param d the dart to overwrite (dest)
* @param e the dart to copy (src)
* @param d the dart to overwrite (dest)
* @param e the dart to copy (src)
*/
void copyCell(unsigned int orbit, Dart d, Dart e) ;
......
......@@ -237,18 +237,11 @@ public:
void insertTrianglePair(Dart d, Dart v1, Dart v2) ;
/**
* Unsew opposite edges from the faces around a vertex
* Unsew the faces consisting of the umbrella of a vertex
* \warning Darts may have
* @param d a dart from the vertex
*/
void unsewAroundVertex(Dart d) ;
/**
* Unsex the Umbrella aroud a vertex, close the hole and then
* create a symetric to construct a polyedron
* @param d a dart from the vertex
*/
void explodPolyhedron(Dart d);
virtual void unsewVertexUmbrella(Dart d) ;
//! Merge two volumes along two faces.
/*! Works only if the two faces have the same number of edges.
......@@ -292,6 +285,12 @@ public:
*/
bool sameOrientedVertex(Dart d, Dart e) ;
//!Test if dart d and e belong to the same oriented face
/*! @param d a dart
* @param e a dart
*/
bool sameOrientedFace(Dart d, Dart e);
//! Test if dart d and e belong to the same vertex
/*! @param d a dart
* @param e a dart
......
......@@ -346,6 +346,14 @@ public:
*************************************************************************/
//@{
//! Test if dart d and e belong to the same oriented face
/*! @param d a dart
* @param e a dart
*/
bool sameFace(Dart d, Dart e);
// TODO devrait disparaitre
// pour les mêmes raisons que dans map2
virtual bool check();
......
......@@ -298,7 +298,7 @@ void Map2::insertTrianglePair(Dart d, Dart v1, Dart v2)
phi2sew(phi1(d), vv1) ;
}
void Map2::unsewAroundVertex(Dart d)
void Map2::unsewVertexUmbrella(Dart d)
{
Dart e = d;
......@@ -318,20 +318,6 @@ void Map2::unsewAroundVertex(Dart d)
while(e != d);
}
void Map2::explodPolyhedron(Dart d)
{
unsewAroundVertex(d);
closeHole(phi1(d));
//Recherche du (ou un des) sommet oppose
//tourner autour du sommet
//si quad alors sommet oppose
//
//si pas de quad alors un sommet du trian
//
}
bool Map2::mergeVolumes(Dart d, Dart e)
{
// First traversal of both faces to check the face sizes
......@@ -441,6 +427,19 @@ bool Map2::sameOrientedVertex(Dart d, Dart e)
return false; // None is equal to e => vertices are distinct
}
bool Map2::sameOrientedFace(Dart d, Dart e)
{
Dart dNext = d;
do //Foreach dart dNext of the face
{
if(dNext == e) //Test equality with e
return true;
dNext = phi1(dNext);
}
while(dNext != d);
return false; // None is equal to e => Faces are distinct
}
unsigned int Map2::vertexDegree(Dart d)
{
unsigned int count = 0 ;
......
......@@ -1142,6 +1142,17 @@ void Map3::closeMap(DartMarker& marker)
// this->releaseMarker(DART,mf3);
//}
//
bool Map3::sameFace(Dart d, Dart e)
{
if(phi3(d) != d)
if(Map2::sameOrientedFace(phi3(d), e))
return true;
return Map2::sameOrientedFace(d,e);
}
bool Map3::check()
{
CGoGNout << "Check: topology begin" << CGoGNendl;
......
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