Commit c6ed99c2 authored by Lionel Untereiner's avatar Lionel Untereiner

debut deform + modifs subdiv

parent df531a08
......@@ -529,9 +529,11 @@ Dart flip1To3(typename PFP::MAP& map, Dart d)
edges.push_back(dit);
map.splitVolume(edges);
map.splitFace(map.phi1(map.phi2(edges[0])),map.phi1(map.phi2(edges[2])));
// Cut the 2nd Tetrahedron
map.splitFace(map.phi1(map.phi2(edges[0])),map.phi1(map.phi2(edges[2])));
// Cut the 3rd Tetrahedron
dit = map.phi1(map.phi2(edges[0]));
edges.clear();
edges.push_back(dit);
......
......@@ -261,6 +261,7 @@ void Map3MR<PFP>::swapGen3To2(Dart d)
}
else // si (n == 2)
{
std::cout << "arrrrrrghhhhhhhhhhhh" << std::endl;
swap2To2(d);
}
}
......@@ -301,6 +302,7 @@ void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices, VertexAttribute<typena
DartMarkerStore m(m_map);
DartMarkerStore newBoundaryV(m_map);
DartMarkerStore newV(m_map);
if(embedNewVertices)
{
......@@ -339,6 +341,8 @@ void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices, VertexAttribute<typena
Dart dres = Volume::Modelisation::Tetrahedralization::flip1To4<PFP>(m_map, dit);
position[dres] = volCenter;
newV.markOrbit<VERTEX>(dres);
}
......@@ -355,6 +359,7 @@ void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices, VertexAttribute<typena
}
}
//
// 1-3 flip of all boundary tetrahedra
//
......@@ -383,6 +388,7 @@ void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices, VertexAttribute<typena
}
}
TraversorV<typename PFP::MAP> tVg(m_map);
for(Dart dit = tVg.begin() ; dit != tVg.end() ; dit = tVg.next())
{
......@@ -428,8 +434,24 @@ void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices, VertexAttribute<typena
// newP += (typename PFP::REAL(1) - K) * P ;
// position[db] = newP ;
}
}
// else if(!m_map.isBoundaryVertex(dit) && !newV.isMarked(dit))
// {
// m_map.decCurrentLevel() ;
// typename PFP::VEC3 np(0) ;
// unsigned int degree = 0 ;
// Traversor3VVaE<typename PFP::MAP> trav(m_map, dit) ;
// for(Dart it = trav.begin(); it != trav.end(); it = trav.next())
// {
// ++degree ;
// np += position[it] ;
// }
// np /= degree;
// m_map.incCurrentLevel() ;
// position[dit] = np;
// }
}
//
// edge-removal on all old boundary edges
......@@ -446,6 +468,8 @@ void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices, VertexAttribute<typena
}
}
m_map.setCurrentLevel(m_map.getMaxLevel());
m_map.popLevel() ;
}
......
......@@ -131,25 +131,57 @@ void filterBandPass(typename PFP::MAP& map, VertexAttribute<T>& attIn, unsigned
map.setCurrentLevel(cur);
}
template <typename PFP, typename T>
void frequencyDeformation(typename PFP::MAP& map, VertexAttribute<T>& attIn, unsigned int cutoffLevel)
template <typename PFP>
typename PFP::VEC3 doTwist(typename PFP::VEC3 pos, float t )
{
unsigned int cur = map.getCurrentLevel();
unsigned int max = map.getMaxLevel();
typedef typename PFP::VEC3 VEC3;
map.setCurrentLevel(max);
float st = std::sin(t);
float ct = std::cos(t);
VEC3 new_pos;
new_pos[0] = pos[0]*ct - pos[2]*st;
new_pos[2] = pos[0]*st + pos[2]*ct;
new_pos[1] = pos[1];
return new_pos;
}
template <typename PFP>
void frequencyDeformation(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& attIn, unsigned int cutoffLevel)
{
float time = 1.0;
//float angle_deg_max = 0.4;
//float height = 0.4;
float A = 20.0;
float frequency = 1.0;
float phase = time * 2.0;
TraversorV<typename PFP::MAP> tv(map);
for (Dart d = tv.begin(); d != tv.end(); d = tv.next())
{
if(vertexLevel<PFP>(map,d) == cutoffLevel)
attIn[d] += T(0.0,0.0,0.2);
}
map.setCurrentLevel(cur);
typename PFP::VEC3 p = attIn[d];
float dist = std::sqrt(p[0]*p[0] + p[2]*p[2]);
p[1] += A * std::sin(frequency * dist + phase);
// float angle_deg = angle_deg_max * std::sin(time);
// float angle_rad = angle_deg * 3.14159 / 180.0;
// float ang = (height*0.5 + attIn[d][1])/height * angle_rad;
// attIn[d] = doTwist<PFP>(attIn[d], ang);
}
}
} // namespace MR
} // namespace Algo
......
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