Commit b4b3e7c8 authored by Sylvain Thery's avatar Sylvain Thery

simplification of gen version of algo, only one parameter

parent 0b6795ab
This diff is collapsed.
This diff is collapsed.
......@@ -89,20 +89,21 @@ void quadranguleFaces(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3
/**
* Catmull-Clark subdivision scheme
*/
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs) ;
template <typename PFP>
void CatmullClarkSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position) ;
//template <typename PFP>
//void CatmullClarkSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position) ;
/**
* Loop subdivision scheme
*/
template <typename PFP, typename EMBV, typename EMB>
//template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs) ;
template <typename PFP>
void LoopSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position) ;
//template <typename PFP>
//void LoopSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position) ;
/**
......@@ -115,8 +116,8 @@ void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs, float size=
/**
* Doo-Sabin subdivision scheme
*/
template <typename PFP>
void DooSabin(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position);
template <typename PFP, typename EMBV>
void DooSabin(typename PFP::MAP& map, EMBV& position);
///**
// * Reverse the orientation of the map
......
......@@ -64,13 +64,15 @@ Dart trianguleFace(typename PFP::MAP& map, Dart d)
return map.phi2(x); // Return a dart of the central vertex
}
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
void trianguleFaces(typename PFP::MAP& map, EMBV& attributs)
{
typedef typename EMBV::DATA_TYPE EMB;
TraversorF<typename PFP::MAP> t(map) ;
for (Dart d = t.begin(); d != t.end(); d = t.next())
{
EMB center = Geometry::faceCentroidGen<PFP,EMBV,EMB>(map, d, attributs); // compute center
EMB center = Geometry::faceCentroid<PFP,EMBV>(map, d, attributs); // compute center
Dart cd = trianguleFace<PFP>(map, d); // triangule the face
attributs[cd] = center; // affect the data to the central vertex
Dart fit = cd ;
......@@ -82,11 +84,11 @@ void trianguleFaces(typename PFP::MAP& map, EMBV& attributs)
}
}
template <typename PFP>
void trianguleFaces(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
{
trianguleFaces<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, position) ;
}
//template <typename PFP>
//void trianguleFaces(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
//{
// trianguleFaces<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, position) ;
//}
template <typename PFP>
void trianguleFaces(
......@@ -125,9 +127,11 @@ Dart quadranguleFace(typename PFP::MAP& map, Dart d)
return map.phi2(x); // Return a dart of the central vertex
}
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs)
{
typedef typename EMBV::DATA_TYPE EMB;
DartMarker me(map) ;
DartMarker mf(map) ;
......@@ -156,7 +160,7 @@ void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs)
{
if ( !map.isBoundaryMarked2(d) && !mf.isMarked(d))
{
EMB center = Geometry::faceCentroidGen<PFP,EMBV,EMB>(map, d, attributs); // compute center
EMB center = Geometry::faceCentroid<PFP,EMBV>(map, d, attributs); // compute center
Dart cf = quadranguleFace<PFP>(map, d); // quadrangule the face
attributs[cf] = center; // affect the data to the central vertex
Dart e = cf;
......@@ -169,15 +173,17 @@ void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs)
}
}
template <typename PFP>
void quadranguleFaces(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
{
quadranguleFaces<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, position) ;
}
//template <typename PFP>
//void quadranguleFaces(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
//{
// quadranguleFaces<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, position) ;
//}
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs)
{
typedef typename EMBV::DATA_TYPE EMB;
std::vector<Dart> l_middles;
std::vector<Dart> l_verts;
......@@ -301,11 +307,11 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs)
}
}
template <typename PFP>
void CatmullClarkSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
{
CatmullClarkSubdivision<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, position) ;
}
//template <typename PFP>
//void CatmullClarkSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
//{
// CatmullClarkSubdivision<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, position) ;
//}
inline double betaF(unsigned int n)
{
......@@ -331,9 +337,11 @@ inline double betaF(unsigned int n)
}
}
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs)
{
typedef typename EMBV::DATA_TYPE EMB;
std::vector<Dart> l_middles;
std::vector<Dart> l_verts;
......@@ -452,15 +460,18 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs)
}
}
template <typename PFP>
void LoopSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
{
LoopSubdivision<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, position) ;
}
//template <typename PFP>
//void LoopSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
//{
//// LoopSubdivision<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, position) ;
// LoopSubdivisionGen<PFP, VertexAttribute<typename PFP::VEC3> >(map, position) ;
//}
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs, float size)
{
typedef typename EMBV::DATA_TYPE EMB;
CellMarker<EDGE> m0(map);
CellMarker<FACE> m1(map);
......@@ -529,9 +540,12 @@ void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs, float size)
}
}
template <typename PFP>
void DooSabin(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
template <typename PFP, typename EMBV>
void DooSabin(typename PFP::MAP& map, EMBV& position)
{
typedef typename EMBV::DATA_TYPE EMB;
DartMarker dm(map);
// storage of boundary of hole (missing vertex faces)
std::vector<Dart> fp;
......@@ -594,7 +608,7 @@ void DooSabin(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
}
}
std::vector<typename PFP::VEC3> buffer;
std::vector<EMB> buffer;
buffer.reserve(8);
for (std::vector<Dart>::iterator di=faces.begin(); di != faces.end(); ++di)
{
......@@ -611,17 +625,17 @@ void DooSabin(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
int N = buffer.size();
for (int i=0; i<N; ++i)
{
typename PFP::VEC3 P(0,0,0);
EMB P(0);
for (int j=0; j<N; ++j)
{
if (j==i)
{
float c1 = float(N+5)/float(4*N);
/*float*/typename PFP::REAL c1 = double(N+5)/double(4*N);
P += buffer[j]*c1;
}
else
{
float c2 = (3.0+2.0*cos(2.0*M_PI*(double(i-j))/double(N))) /(4.0*N);
/*float*/typename PFP::REAL c2 = (3.0+2.0*cos(2.0*M_PI*(double(i-j))/double(N))) /(4.0*N);
P+= c2*buffer[j];
}
}
......
......@@ -88,14 +88,14 @@ std::vector<Dart> sliceConvexVolumes(typename PFP::MAP& map, VertexAttribute<typ
* @param map the map
* @param attributs geometric attributes of the vertices
*/
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs);
template <typename PFP>
void catmullClarkVol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
{
catmullClarkVol<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, position);
}
//template <typename PFP>
//void catmullClarkVol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position)
//{
// catmullClarkVol<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, position);
//}
template <typename PFP>
void sqrt3Vol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position);
......
......@@ -435,9 +435,11 @@ std::vector<Dart> sliceConvexVolumes(typename PFP::MAP& map, VertexAttribute<typ
return vRes;
}
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs)
{
typedef typename EMBV::DATA_TYPE EMB;
//std::vector<Dart> l_centers;
std::vector<Dart> l_vertices;
......@@ -474,7 +476,7 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs)
TraversorF<typename PFP::MAP> travF(map) ;
for (Dart d = travF.begin(); d != travF.end(); d = travF.next())
{
EMB center = Surface::Geometry::faceCentroidGen<PFP,EMBV,EMB>(map,d,attributs);
EMB center = Surface::Geometry::faceCentroid<PFP,EMBV>(map,d,attributs);
Dart dd = map.phi1(d) ;
Dart next = map.phi1(map.phi1(dd)) ;
......
......@@ -286,7 +286,7 @@ public:
* @param map the map
* @param colors attribute of dart's colors
*/
template<typename PFP, typename EMBV, typename EMB>
template<typename PFP, typename EMBV>
void updateColorsGen(typename PFP::MAP& map, const EMBV& colors);
template<typename PFP>
......
......@@ -282,9 +282,11 @@ void Topo3Render::setDartsIdColor(typename PFP::MAP& map)
glUnmapBuffer(GL_ARRAY_BUFFER);
}
template<typename PFP, typename EMBV, typename EMB>
template<typename PFP, typename EMBV>
void Topo3Render::updateColorsGen(typename PFP::MAP& map, const EMBV& colors)
{
typedef typename EMBV::DATA_TYPE EMB;
m_vbo4->bind();
EMB* colorBuffer = reinterpret_cast<EMB*>(glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE));
unsigned int nb=0;
......@@ -311,7 +313,8 @@ void Topo3Render::updateColorsGen(typename PFP::MAP& map, const EMBV& colors)
template<typename PFP>
void Topo3Render::updateColors(typename PFP::MAP& map, const VertexAttribute<Geom::Vec3f>& colors)
{
updateColorsGen<PFP, Geom::Vec3f, VertexAttribute<Geom::Vec3f> >(map,colors);
// updateColorsGen<PFP, VertexAttribute<Geom::Vec3f> >(map,colors);
updateColorsGen<PFP>(map,colors);
}
template<typename PFP>
......
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