Commit d25284ab authored by Lionel Untereiner's avatar Lionel Untereiner

volumetric sqrt3 MR subdivision

parent 60beb9e6
......@@ -647,7 +647,15 @@ void sqrt3Vol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
m.markOrbit<FACE>(ditWF);
}
Algo::Modelisation::Tetrahedralization::flip1To4<PFP>(map, dit, position);
typename PFP::VEC3 volCenter(0.0);
volCenter += position[dit];
volCenter += position[map.phi1(dit)];
volCenter += position[map.phi_1(dit)];
volCenter += position[map.phi_1(map.phi2(dit))];
volCenter /= 4;
Dart dres = Algo::Modelisation::Tetrahedralization::flip1To4<PFP>(map, dit);
position[dres] = volCenter;
}
//
......@@ -678,7 +686,14 @@ void sqrt3Vol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
m.markOrbit<EDGE>(ditWE);
}
Algo::Modelisation::Tetrahedralization::flip1To3<PFP>(map, dit, position);
typename PFP::VEC3 faceCenter(0.0);
faceCenter += position[dit];
faceCenter += position[map.phi1(dit)];
faceCenter += position[map.phi_1(dit)];
faceCenter /= 3;
Dart dres = Algo::Modelisation::Tetrahedralization::flip1To3<PFP>(map, dit);
position[dres] = faceCenter;
}
}
......@@ -691,8 +706,6 @@ void sqrt3Vol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
if(m.isMarked(dit))
{
m.unmarkOrbit<EDGE>(dit);
//std::cout << " nb F of E : " << map.template degree<typename PFP::MAP,EDGE,FACE>(dit) << std::endl;
Dart d = map.phi2(map.phi3(map.findBoundaryFaceOfEdge(dit)));
Algo::Modelisation::Tetrahedralization::swapGen3To2<PFP>(map, d);
......
......@@ -147,17 +147,17 @@ void swapGen2To3(typename PFP::MAP& map, Dart d);
*
*/
template <typename PFP>
Dart flip1To4(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position);
Dart flip1To4(typename PFP::MAP& map, Dart d);
//!
/*!
*
*/
template <typename PFP>
Dart flip1To3(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position);
Dart flip1To3(typename PFP::MAP& map, Dart d);
/************************************************************************************************
* Bisection Functions *
* Bisection Functions *
************************************************************************************************/
//!
......@@ -165,7 +165,7 @@ Dart flip1To3(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3
*
*/
template <typename PFP>
Dart edgeBisection(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position);
Dart edgeBisection(typename PFP::MAP& map, Dart d);
} // namespace Tetrahedralization
......
......@@ -455,30 +455,19 @@ void swapGen2To3(typename PFP::MAP& map, Dart d)
************************************************************************************************/
template <typename PFP>
Dart flip1To4(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position)
Dart flip1To4(typename PFP::MAP& map, Dart d)
{
std::vector<Dart> edges;
typename PFP::VEC3 volCenter(0.0);
//
// Cut the 1st tetrahedron
//
edges.push_back(map.phi2(d));
volCenter += position[edges[0]];
edges.push_back(map.phi2(map.phi1(d)));
volCenter += position[edges[1]];
edges.push_back(map.phi2(map.phi_1(d)));
volCenter += position[edges[2]];
map.splitVolume(edges);
volCenter += position[map.phi_1(edges[2])];
volCenter /= 4;
Dart x = Algo::Modelisation::trianguleFace<PFP>(map,map.phi2(d));
position[x] = volCenter;
//
// Cut the 2nd tetrahedron
......@@ -513,21 +502,14 @@ Dart flip1To4(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3
}
template <typename PFP>
Dart flip1To3(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position)
Dart flip1To3(typename PFP::MAP& map, Dart d)
{
std::vector<Dart> edges;
typename PFP::VEC3 faceCenter(0.0);
faceCenter += position[d];
faceCenter += position[map.phi1(d)];
faceCenter += position[map.phi_1(d)];
faceCenter /= 3;
//
// Triangule one face
//
Dart x = Algo::Modelisation::trianguleFace<PFP>(map,d);
position[x] = faceCenter;
//
// Cut the 1st Tetrahedron
......@@ -564,15 +546,11 @@ Dart flip1To3(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3
************************************************************************************************/
template <typename PFP>
Dart edgeBisection(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position)
Dart edgeBisection(typename PFP::MAP& map, Dart d)
{
//coupe l'arete en 2
Dart f = map.phi1(d);
map.cutEdge(d);
Dart e = map.phi1(d);
position[e] = position[d];
position[e] += position[f];
position[e] *= 0.5;
Dart dit = e;
do
......
......@@ -135,6 +135,11 @@ public:
Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
m_position[midV] = p ;
}
else
{
Dart midV = m_map.phi_1(m_map.phi2(d));
m_position[midV] = p;
}
m_map.decCurrentLevel() ;
}
......
......@@ -120,60 +120,58 @@ void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices)
m_map.duplicateDarts(m_map.getMaxLevel());
m_map.setCurrentLevel(m_map.getMaxLevel());
unsigned int cur = m_map.getCurrentLevel();
DartMarkerStore m(m_map);
//
TraversorW<typename PFP::MAP> travW(m_map);
for(Dart dit = travW.begin() ; dit != travW.end() ; dit = travW.next())
// 1-4 flip of all tetrahedra
//
TraversorW<typename PFP::MAP> tW(m_map);
for(Dart dit = tW.begin() ; dit != tW.end() ; dit = tW.next())
{
m_map.setCurrentLevel(cur+1);
//store the new faces to 3-sew
std::vector<std::pair<Dart,Dart> > nFaces;
nFaces.reserve(6);
Traversor3WF<typename PFP::MAP> travWF(m_map, dit);
for(Dart ditWF = travWF.begin() ; ditWF != travWF.end() ; ditWF = travWF.next())
Traversor3WF<typename PFP::MAP> tWF(m_map, dit);
for(Dart ditWF = tWF.begin() ; ditWF != tWF.end() ; ditWF = tWF.next())
{
// Dart temp = ditWF;
// do
// {
// nFaces.push_back(std::pair<Dart,Dart>(temp, m_map.phi2(temp)));
// m_map.unsewFaces(temp);
// temp = m_map.phi1(temp);
// }
// while(temp != ditWF);
//
// m_map.PFP::MAP::ParentMap::closeHole(ditWF, false);
//Dart fi = map.phi2(*face);
// std::vector<Dart> split;
// split.push_back(ditWF);
// split.push_back(m_map.phi1(ditWF));
// split.push_back(m_map.phi_1(ditWF));
//
// splitSurfaceInVolume(split,true,false);
if(!m_map.isBoundaryFace(ditWF))
m.markOrbit<FACE>(ditWF);
}
//Dart fi = map.phi2(*face);
Algo::Modelisation::Tetrahedralization::flip1To4<PFP>(m_map, dit);
}
// //coudre les nouveaux brins entre eux par phi3
// for (std::vector<std::pair<Dart,Dart> >::iterator face =nFaces.begin(); face != nFaces.end(); ++face)
// {
//
// if(map.phi3(map.phi2((*face).first)) == map.phi2((*face).first))
// map.sewVolumes(map.phi2((*face).first), map.phi2((*face).second));
// }
//
m_map.setCurrentLevel(cur);
//
// 2-3 swap of all old interior faces
//
TraversorF<typename PFP::MAP> tF(m_map);
for(Dart dit = tF.begin() ; dit != tF.end() ; dit = tF.next())
{
if(m.isMarked(dit))
{
m.unmarkOrbit<FACE>(dit);
Algo::Modelisation::Tetrahedralization::swap2To3<PFP>(m_map, dit);
}
}
/*
//
// 1-3 flip of all boundary tetrahedra
//
TraversorW<typename PFP::MAP> tWb(m_map);
for(Dart dit = tWb.begin() ; dit != tWb.end() ; dit = tWb.next())
{
if(m_map.isBoundaryVolume(dit))
{
Traversor3WE<typename PFP::MAP> tWE(m_map, dit);
for(Dart ditWE = tWE.begin() ; ditWE != tWE.end() ; ditWE = tWE.next())
{
if(m_map.isBoundaryEdge(ditWE))
m.markOrbit<EDGE>(ditWE);
}
Algo::Modelisation::Tetrahedralization::flip1To3<PFP>(m_map, dit);
}
}
*/
m_map.setCurrentLevel(m_map.getMaxLevel());
m_map.popLevel() ;
}
template <typename PFP>
......
......@@ -212,7 +212,7 @@ void verticesRaySelection(typename PFP::MAP& map, const VertexAttribute<typename
template<typename PFP>
void volumesRaySelection(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const FunctorSelect& good, const typename PFP::VEC3& rayA, const typename PFP::VEC3& rayAB, std::vector<Dart>& vecVolumes)
{
std::vector<Dart>& vecFaces;
std::vector<Dart> vecFaces;
std::vector<typename PFP::VEC3> iPoints;
// get back intersected faces
......@@ -425,7 +425,7 @@ void facesPlanSelection(typename PFP::MAP& map, const VertexAttribute<typename P
* @param angle angle of the code in degree.
*/
template<typename PFP>
void verticesConeSelection(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const typename PFP::VEC3& rayA, const typename PFP::VEC3& rayAB, float angle, std::vector<Dart>& vecVertices, const FunctorSelect& good= allDarts)
void verticesConeSelection(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const typename PFP::VEC3& rayA, const typename PFP::VEC3& rayAB, float angle, std::vector<Dart>& vecVertices, const FunctorSelect& good)
{
typename PFP::REAL AB2 = rayAB * rayAB;
......@@ -533,7 +533,7 @@ void edgesConeSelection(typename PFP::MAP& map, const VertexAttribute<typename P
template<typename PFP>
Dart verticesBubbleSelection(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const typename PFP::VEC3& cursor, typename PFP::REAL radiusMax, const FunctorSelect& good=allDarts)
Dart verticesBubbleSelection(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const typename PFP::VEC3& cursor, typename PFP::REAL radiusMax, const FunctorSelect& good)
{
typename PFP::REAL l2max = radiusMax*radiusMax;
typename PFP::REAL l2min(std::numeric_limits<float>::max());
......@@ -555,7 +555,7 @@ Dart verticesBubbleSelection(typename PFP::MAP& map, const VertexAttribute<typen
template<typename PFP>
Dart edgesBubbleSelection(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const typename PFP::VEC3& cursor, typename PFP::REAL radiusMax, const FunctorSelect& good=allDarts)
Dart edgesBubbleSelection(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const typename PFP::VEC3& cursor, typename PFP::REAL radiusMax, const FunctorSelect& good)
{
typename PFP::REAL l2max = radiusMax*radiusMax;
typename PFP::REAL l2min(std::numeric_limits<float>::max());
......@@ -661,7 +661,7 @@ Dart edgesBubbleSelection(typename PFP::MAP& map, const VertexAttribute<typename
//
//
//template<typename PFP>
//void verticesRaySelection(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const typename PFP::VEC3& rayA, const typename PFP::VEC3& rayAB, std::vector<Dart>& vecVertices, float dist, const FunctorSelect& good= allDarts, unsigned int nbth=0, unsigned int current_thread=0)
//void verticesRaySelection(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const typename PFP::VEC3& rayA, const typename PFP::VEC3& rayAB, std::vector<Dart>& vecVertices, float dist, const FunctorSelect& good, unsigned int nbth=0, unsigned int current_thread=0)
//{
// typename PFP::REAL dist2 = dist * dist;
// typename PFP::REAL AB2 = rayAB * rayAB;
......
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