Commit 8367821e authored by Lionel Untereiner's avatar Lionel Untereiner

some changes

parent a0a2dc32
......@@ -15,4 +15,4 @@ ADD_SUBDIRECTORY(surface_modelisation)
ADD_SUBDIRECTORY(volume_import)
#ADD_SUBDIRECTORY(volume_render)
ADD_SUBDIRECTORY(volumetric)
#ADD_SUBDIRECTORY(volumetric)
......@@ -62,7 +62,7 @@ template <typename PFP>
void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, SubdivideType sType = S_TRI);
template <typename PFP>
Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position);
Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, bool OneLevelDifference = true);
......
......@@ -194,7 +194,7 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
}
template <typename PFP>
Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position)
Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, bool OneLevelDifference)
//Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, Algo::Volume::IHM::AttributeHandler_IHM<typename PFP::VEC3, VERTEX>& position)
{
assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
......@@ -207,14 +207,17 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, VertexAttribute<type
unsigned int cur = map.getCurrentLevel();
map.setCurrentLevel(vLevel);
// //one level of subdivision in the neighbordhood
// Traversor3VW<typename PFP::MAP> trav3EW(map, old);
// for(Dart dit = trav3EW.begin() ; dit != trav3EW.end() ; dit = trav3EW.next())
// {
// Dart oldit = map.volumeOldestDart(dit);
// if(((vLevel+1) - map.volumeLevel(oldit)) > 1)
// IHM::subdivideVolumeClassic<PFP>(map, oldit, position);
// }
if(OneLevelDifference)
{
Traversor3WF<typename PFP::MAP> traF(map, old);
for(Dart dit = traF.begin(); dit != traF.end(); dit = traF.next())
{
Dart nv = map.phi3(dit);
if(!map.isBoundaryMarked(3, nv))
if(map.volumeLevel(nv) == vLevel - 1)
subdivideVolumeClassic<PFP>(map,nv,position,OneLevelDifference);
}
}
/*
* au niveau du volume courant i
......@@ -313,15 +316,34 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, VertexAttribute<type
//Second step : deconnect each corner, close each hole, subdivide each new face into 3
for (std::vector<Dart>::iterator edge = oldEdges.begin(); edge != oldEdges.end(); ++edge)
{
Dart e = *edge;
Dart e = *edge;
std::vector<Dart> v ;
// unsigned int cur = map.getCurrentLevel();
// map.setCurrentLevel(map.getMaxLevel());
do
{
v.push_back(map.phi1(e));
v.push_back(map.phi1(map.phi1(e)));
{
if(map.faceLevel(map.phi1(e)) > map.getCurrentLevel())
{
std::cout << "plop" << std::endl;
return NIL;
}
else
{
v.push_back(map.phi1(e));
v.push_back(map.phi1(map.phi1(e)));
}
// Dart dit = map.phi1(e);
// do
// {
// v.push_back(dit);
// dit = map.phi1(dit);
// }while(dit != map.phi_1(e));
// v.push_back(map.phi1(e));
// v.push_back(map.phi1(map.phi1(e)));
std::cout << "v size = " << v.size() << std::endl;
e = map.phi2(map.phi_1(e));
}
while(e != *edge);
......@@ -363,6 +385,8 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, VertexAttribute<type
}
while(dd != stop);
// map.setCurrentLevel(cur);
//map.computeVertexVertexFunctor(e);
}
......
......@@ -221,10 +221,10 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
int s0,s1,s2,s3;
oss >> s0;
oss >> s1;
oss >> s2;
oss >> s3;
oss >> s0;
oss >> s3;
oss >> s2;
oss >> s1;
//std::cout << "connector " << s0 << " " << s1 << " " << s2 << " " << s3 << std::endl;
......@@ -241,8 +241,9 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
int s0,s1,s2,s3;
oss >> s0;
//switched s0 and s1
oss >> s1;
oss >> s0;
oss >> s2;
oss >> s3;
......@@ -251,12 +252,12 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
typename PFP::VEC3 B = position[verticesID[s2]];
typename PFP::VEC3 C = position[verticesID[s3]];
if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::OVER)
{
int ui = s1;
s1 = s2;
s2 = ui;
}
// if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::OVER)
// {
// int ui = s1;
// s1 = s2;
// s2 = ui;
// }
m_emb.push_back(verticesID[s0]);
m_emb.push_back(verticesID[s1]);
......@@ -270,33 +271,34 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
int s0,s1,s2,s3,s4;
oss >> s0;
oss >> s1;
oss >> s2;
//reversed order s0->s3 to s3->s0
oss >> s3;
oss >> s2;
oss >> s1;
oss >> s0;
oss >> s4;
typename PFP::VEC3 P = position[verticesID[s4]];
typename PFP::VEC3 A = position[verticesID[s0]];
typename PFP::VEC3 B = position[verticesID[s1]];
typename PFP::VEC3 C = position[verticesID[s2]];
// typename PFP::VEC3 P = position[verticesID[s4]];
// typename PFP::VEC3 A = position[verticesID[s0]];
// typename PFP::VEC3 B = position[verticesID[s1]];
// typename PFP::VEC3 C = position[verticesID[s2]];
// 1 pyra ok avec cette partie
if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::UNDER)
{
unsigned int pt[5];
pt[0] = s4;
pt[1] = s0;
pt[2] = s1;
pt[3] = s2;
pt[4] = s3;
// // 1 pyra ok avec cette partie
// if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::UNDER)
// {
// unsigned int pt[5];
// pt[0] = s4;
// pt[1] = s0;
// pt[2] = s1;
// pt[3] = s2;
// pt[4] = s3;
s0 = pt[0];
s1 = pt[1];
s2 = pt[2];
s3 = pt[3];
s4 = pt[4];
}
// s0 = pt[0];
// s1 = pt[1];
// s2 = pt[2];
// s3 = pt[3];
// s4 = pt[4];
// }
m_emb.push_back(verticesID[s0]);
m_emb.push_back(verticesID[s1]);
......@@ -311,12 +313,13 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
int s0,s1,s2,s3,s4,s5;
oss >> s0;
oss >> s1;
//switch s0-s2 and s5-s3
oss >> s2;
oss >> s3;
oss >> s4;
oss >> s1;
oss >> s0;
oss >> s5;
oss >> s4;
oss >> s3;
// 1 prism ok sans cette partie
// typename PFP::VEC3 P = position[verticesID[s5]];
......@@ -358,42 +361,43 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
int s0,s1,s2,s3,s4,s5,s6,s7;
oss >> s0;
oss >> s1;
oss >> s2;
//revered order s0->s3 to s3->s0 and s4->s7 to s7->s4
oss >> s3;
oss >> s4;
oss >> s5;
oss >> s6;
oss >> s2;
oss >> s1;
oss >> s0;
oss >> s7;
oss >> s6;
oss >> s5;
oss >> s4;
typename PFP::VEC3 P = position[verticesID[s4]];
typename PFP::VEC3 A = position[verticesID[s0]];
typename PFP::VEC3 B = position[verticesID[s1]];
typename PFP::VEC3 C = position[verticesID[s2]];
typename PFP::VEC3 P = position[verticesID[s4]];
typename PFP::VEC3 A = position[verticesID[s0]];
typename PFP::VEC3 B = position[verticesID[s1]];
typename PFP::VEC3 C = position[verticesID[s2]];
// 1 hexa ok avec cette partie
if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::OVER)
{
unsigned int pt[8];
pt[0] = s0;
pt[1] = s1;
pt[2] = s3;
pt[3] = s2;
pt[4] = s4;
pt[5] = s5;
pt[6] = s7;
pt[7] = s6;
s0 = pt[0];
s1 = pt[1];
s2 = pt[2];
s3 = pt[3];
s4 = pt[4];
s5 = pt[5];
s6 = pt[6];
s7 = pt[7];
}
// 1 hexa ok avec cette partie
if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::OVER)
{
unsigned int pt[8];
pt[0] = s2;
pt[1] = s3;
pt[2] = s1;
pt[3] = s0;
pt[4] = s6;
pt[5] = s7;
pt[6] = s5;
pt[7] = s4;
s0 = pt[0];
s1 = pt[1];
s2 = pt[2];
s3 = pt[3];
s4 = pt[4];
s5 = pt[5];
s6 = pt[6];
s7 = pt[7];
}
m_emb.push_back(verticesID[s0]);
m_emb.push_back(verticesID[s1]);
......
......@@ -421,7 +421,7 @@ bool isHexahedron(typename PFP::MAP& the_map, Dart d, unsigned int thread)
unsigned int nbFaces = 0;
//Test the number of faces end its valency
Traversor3WF<typename PFP::MAP> travWF(the_map, d, false, thread);
Traversor3WF<typename PFP::MAP> travWF(the_map, d, false);
for(Dart dit = travWF.begin() ; dit != travWF.end(); dit = travWF.next())
{
//increase the number of faces
......
......@@ -308,8 +308,8 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const EMBV& posit
foreach_cell<MAP::FACE_OF_PARENT>(map, [&] (Cell<MAP::FACE_OF_PARENT> d)
{
// compute normals
VEC3 centerFace = Algo::Surface::Geometry::faceCentroidELW<PFP>(map, d, positions);
VEC3 centerNormalFace = Algo::Surface::Geometry::newellNormal<PFP>(map, d, positions);
VEC3 centerFace = Algo::Surface::Geometry::faceCentroidELW<PFP>(map, d.dart, positions);
VEC3 centerNormalFace = Algo::Surface::Geometry::newellNormal<PFP>(map, d.dart, positions);
computeFace<PFP>(map,d,positions,centerFace,centerNormalFace,vertices,normals);
......@@ -323,7 +323,7 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const EMBV& posit
if (nbs == 3)
{
buffer.push_back(PFP::toVec3f(centerVolumes[d]));
buffer.push_back(PFP::toVec3f(centerVolumes[d.dart]));
bufferColors.push_back(PFP::toVec3f(centerFace));
bufferNormals.push_back(PFP::toVec3f(centerNormalFace)); // unsused just for fill
......@@ -343,7 +343,7 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const EMBV& posit
{
for (unsigned int i=0; i<nbs; ++i)
{
buffer.push_back(PFP::toVec3f(centerVolumes[d]));
buffer.push_back(PFP::toVec3f(centerVolumes[d.dart]));
bufferColors.push_back(PFP::toVec3f(centerFace));
bufferNormals.push_back(PFP::toVec3f(centerNormalFace)); // unsused just for fill
......@@ -555,7 +555,7 @@ void ExplodeVolumeRender::updateData(typename PFP::MAP& map, const EMBV& positio
// TraversorCell<MAP, MAP::FACE_OF_PARENT> traFace(map);
foreach_cell<MAP::FACE_OF_PARENT>(map, [&] (Cell<MAP::FACE_OF_PARENT> d)
{
VEC3F centerFace = PFP::toVec3f(Algo::Surface::Geometry::faceCentroidELW<PFP>(map, d, positions));
VEC3F centerFace = PFP::toVec3f(Algo::Surface::Geometry::faceCentroidELW<PFP>(map, d.dart, positions));
Dart b = d;
Dart c = map.phi1(b);
......@@ -563,7 +563,7 @@ void ExplodeVolumeRender::updateData(typename PFP::MAP& map, const EMBV& positio
if (map.phi1(a) == d)
{
buffer.push_back(PFP::toVec3f(centerVolumes[d]));
buffer.push_back(PFP::toVec3f(centerVolumes[d.dart]));
bufferColors.push_back(centerFace);
buffer.push_back(PFP::toVec3f(positions[b]));
......@@ -580,7 +580,7 @@ void ExplodeVolumeRender::updateData(typename PFP::MAP& map, const EMBV& positio
// loop to cut a polygon in triangle on the fly (ceter point method)
do
{
buffer.push_back(PFP::toVec3f(centerVolumes[d]));
buffer.push_back(PFP::toVec3f(centerVolumes[d.dart]));
bufferColors.push_back(centerFace);
buffer.push_back(centerFace);
......
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