Commit 517a6df8 authored by Sylvain Thery's avatar Sylvain Thery

qem pb compil + warnings

parent 0ba4ba3f
......@@ -72,7 +72,7 @@ int main(int argc, char **argv)
std::vector<VertexAttribute<typename PFP::VEC3, MAP> > attr;
attr.push_back(position);
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices * 0.05) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices /20) ;
VertexAttribute<PFP::VEC3, MAP> normal = myMap.addAttribute<PFP::VEC3,VERTEX,MAP>( "normal") ;
VertexAttribute<PFP::VEC3, MAP> position2 = myMap.addAttribute<PFP::VEC3,VERTEX,MAP>( "pos2") ;
......
......@@ -54,19 +54,19 @@ int main(int argc, char **argv)
std::vector<VertexAttribute<typename PFP::VEC3, MAP> > attr;
attr.push_back(position);
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices * 0.1) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices / 10) ;
Algo::Surface::Modelisation::LoopSubdivision<PFP>(myMap, position) ;
Algo::Surface::Modelisation::LoopSubdivision<PFP>(myMap, position) ;
nbVertices = Algo::Topo::getNbOrbits<VERTEX>(myMap) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices * 0.1) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices / 10);
Algo::Surface::Modelisation::LoopSubdivision<PFP>(myMap, position) ;
Algo::Surface::Modelisation::LoopSubdivision<PFP>(myMap, position) ;
nbVertices = Algo::Topo::getNbOrbits<VERTEX>(myMap) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices * 0.1) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices / 10);
Algo::Surface::Modelisation::CatmullClarkSubdivision<PFP>(myMap, position) ;
Algo::Surface::Modelisation::CatmullClarkSubdivision<PFP>(myMap, position) ;
......
......@@ -81,9 +81,11 @@ int main()
});
centerFace /=nbVert;
centerVol += centerFace;
nbFaces++;
});
centerVol /= nbFaces;
centerMesh += centerVol;
nbVols++;
});
centerMesh /= nbVols;
CGoGNout<< "Traverse with foreach in " << ch.elapsed()<< " ms"<< CGoGNendl;
......@@ -110,9 +112,11 @@ int main()
}
centerFace /=nbVert;
centerVol += centerFace;
nbFaces++;
}
centerVol /= nbFaces;
centerMesh += centerVol;
nbVols++;
}
CGoGNout<< "Traverse with traversor in " << ch.elapsed()<< " ms"<< CGoGNendl;
......
......@@ -204,7 +204,7 @@ void Viewer::cb_keyPress(int keycode)
{
std::cout << "PlaneCut"<< std::endl;
Geom::Vec3f n(0.1,0.1,1.0);
Geom::Vec3f n(0.1f,0.1f,1.0f);
Geom::Vec3f o = bb.center();
Geom::Plane3D<PFP::REAL> plan(n,o);
......@@ -239,7 +239,7 @@ void Viewer::cb_keyPress(int keycode)
{
std::cout << "PlaneCut"<< std::endl;
Geom::Vec3f n(0.1,0.1,1.0);
Geom::Vec3f n(0.1f,0.1f,1.0f);
Geom::Vec3f o = bb.center();
Geom::Plane3D<PFP::REAL> plan(n,o);
......
......@@ -119,7 +119,7 @@ void MyQT::squareTiling(int code)
{
std::cout << "square grid twisted strip tiling" << std::endl;
Algo::Surface::Tilings::Square::Grid<PFP> g(myMap, 10, 10, true);
g.embedIntoTwistedStrip(position, 0.2, 0.7, 5);
g.embedIntoTwistedStrip(position, 0.2f, 0.7f, 5);
Geom::Matrix44f trf;
trf.identity();
......@@ -151,11 +151,11 @@ void MyQT::squareTiling(int code)
{
std::cout << "square cylinder tiling" << std::endl;
Algo::Surface::Tilings::Square::Cylinder<PFP> c(myMap,20,20);
c.embedIntoCylinder(position,0.5,0.7,1.0);
c.embedIntoCylinder(position,0.5f,0.7f,1.0f);
Geom::Matrix44f trf;
trf.identity();
Geom::translate<float>(0.5,0.5,0.0,trf);
Geom::translate<float>(0.5f,0.5f,0.0f,trf);
c.transform(position, trf);
......@@ -169,7 +169,7 @@ void MyQT::squareTiling(int code)
Algo::Surface::Tilings::Square::Cylinder<PFP> c(myMap,20,20);
c.triangleBottom();
c.triangleTop();
c.embedIntoCylinder(position,0.5,0.7,1.0);
c.embedIntoCylinder(position,0.5f,0.7f,1.0f);
break;
}
......@@ -212,7 +212,7 @@ void MyQT::squareTiling(int code)
{
std::cout << "square tore tiling" << std::endl;
Algo::Surface::Tilings::Square::Tore<PFP> c(myMap,20,10);
c.embedIntoTore(position, 0.9, 0.5);
c.embedIntoTore(position, 0.9f, 0.5f);
c.exportPositions(position, "tore.bs");
break;
......@@ -244,7 +244,7 @@ void MyQT::triangularTiling(int code)
{
std::cout << "triangle grid twisted strip tiling" << std::endl;
Algo::Surface::Tilings::Triangular::Grid<PFP> g(myMap,10,10,true);
g.embedIntoTwistedStrip(position, 0.3, 0.8, 5);
g.embedIntoTwistedStrip(position, 0.3f, 0.8f, 5);
break;
}
......@@ -252,7 +252,7 @@ void MyQT::triangularTiling(int code)
{
std::cout << "triangle grid helocoid tiling" << std::endl;
Algo::Surface::Tilings::Triangular::Grid<PFP> g(myMap,20,20,true);
g.embedIntoHelicoid(position, 0.3, 0.8, 5.0, 2.0);
g.embedIntoHelicoid(position, 0.3f, 0.8f, 5.0f, 2.0f);
break;
}
......@@ -260,7 +260,7 @@ void MyQT::triangularTiling(int code)
{
std::cout << "triangle cylinder tiling" << std::endl;
Algo::Surface::Tilings::Triangular::Cylinder<PFP> c(myMap,20,20);
c.embedIntoCylinder(position,0.5,0.7,5.0);
c.embedIntoCylinder(position,0.5f,0.7f,5.0f);
break;
}
......@@ -270,7 +270,7 @@ void MyQT::triangularTiling(int code)
Algo::Surface::Tilings::Triangular::Cylinder<PFP> c(myMap,20,20);
c.triangleBottom();
c.triangleTop();
c.embedIntoCylinder(position,0.5,0.7,5.0);
c.embedIntoCylinder(position,0.5f,0.7f,5.0f);
break;
}
......@@ -280,7 +280,7 @@ void MyQT::triangularTiling(int code)
Algo::Surface::Tilings::Triangular::Cylinder<PFP> c(myMap,20,20);
c.triangleTop();
c.triangleBottom();
c.embedIntoSphere(position,0.5);
c.embedIntoSphere(position,0.5f);
break;
}
......@@ -290,7 +290,7 @@ void MyQT::triangularTiling(int code)
Algo::Surface::Tilings::Triangular::Cylinder<PFP> c(myMap,20,20);
c.triangleTop();
c.triangleBottom();
c.embedIntoCone(position,0.5, 5.0);
c.embedIntoCone(position,0.5f, 5.0f);
break;
}
......@@ -298,7 +298,7 @@ void MyQT::triangularTiling(int code)
{
std::cout << "triangle cube tiling" << std::endl;
Algo::Surface::Tilings::Triangular::Cube<PFP> c(myMap,4,4,4);
c.embedIntoCube(position,5.0,5.0, 5.0);
c.embedIntoCube(position,5.0f,5.0f, 5.0f);
break;
}
......@@ -306,7 +306,7 @@ void MyQT::triangularTiling(int code)
{
std::cout << "triangle tore tiling" << std::endl;
Algo::Surface::Tilings::Triangular::Tore<PFP> c(myMap,20,10);
c.embedIntoTore(position,5.0,2.0);
c.embedIntoTore(position,5.0f,2.0f);
break;
}
......
......@@ -82,7 +82,7 @@ int main()
std::cout << "Check arePointsEquals : Start" << std::endl;
VEC3 p1(0,0,0);
VEC3 p2(0.1,0.1,0.1);
VEC3 p2(0.1f,0.1f,0.1f);
if(!Geom::arePointsEquals<VEC3>(p1,p1) || !Geom::arePointsEquals<VEC3>(p2,p2)
|| Geom::arePointsEquals<VEC3>(p1,p2) || Geom::arePointsEquals<VEC3>(p2,p1))
{
......
......@@ -375,7 +375,7 @@ public:
m_positionApproximator(posApprox)
{
bb = Algo::Geometry::computeBoundingBox<PFP>(m, pos) ;
radius = bb.diagSize() * 0.003 ;
radius = bb.diagSize() * 0.003f ;
normal = m.template getAttribute<VEC3, VERTEX, MAP>("normal") ;
if(!normal.isValid())
......
......@@ -84,8 +84,8 @@ bool EdgeSelector_Random<PFP>::init()
for(Dart d = m.begin(); d != m.end(); m.next(d))
darts.push_back(d) ;
srand(time(NULL)) ;
int remains = darts.size() ;
srand((unsigned int )(time(NULL))) ;
int remains = int(darts.size()) ;
for(unsigned int i = 0; i < darts.size()-1; ++i) // generate the random permutation
{
int r = (rand() % remains) + i ;
......@@ -1979,11 +1979,10 @@ void EdgeSelector_GeomColOptGradient<PFP>::computeEdgeInfo(Dart d, EdgeInfo& ein
const VEC3& newCol = m_colorApproximator.getApprox(d) ;
// sum of QEM metric and color gradient metric
const REAL t = 0.01 ;
const REAL t = 0.01f ;
const REAL err =
t * quad(newPos) +
(1-t) * (computeEdgeGradientColorError(d, newPos, newCol) + computeEdgeGradientColorError(m.phi2(d), newPos, newCol)).norm() / sqrt(3)
;
(1-t) * (computeEdgeGradientColorError(d, newPos, newCol) + computeEdgeGradientColorError(m.phi2(d), newPos, newCol)).norm() / sqrt(3.0) ;
einfo.it = edges.insert(std::make_pair(err, d)) ;
einfo.valid = true ;
......
......@@ -1031,10 +1031,10 @@ void HalfEdgeSelector_ColorGradient<PFP>::computeHalfEdgeInfo(Dart d, HalfEdgeIn
//std::cout << quadGeom(newPos) / (alpha/M_PI + quadHF(newHF)) << std::endl ;
// sum of QEM metric and color gradient metric
const REAL t = 0.01 ;
const REAL t = 0.01f ;
const REAL& err =
t * quadGeom(newPos) + // geom
(1-t) * computeGradientColorError(v0,v1).norm()/sqrt(3) // color
(1-t) * computeGradientColorError(v0,v1).norm()/sqrt(3.0) // color
;
/*std::cout << quadGeom(newPos) << std::endl ;
......
......@@ -77,7 +77,7 @@ typename PFP::REAL meanEdgeLength(typename PFP::MAP& map, const VertexAttribute<
typename PFP::REAL length(0);
unsigned int nbe = 0;
for (unsigned int i = 0; i < CGoGN::Parallel::NumberOfThreads; ++i)
for (int i = 0; i < CGoGN::Parallel::NumberOfThreads; ++i)
{
length += lengths[i];
nbe += nbedges[i];
......
......@@ -547,7 +547,7 @@ void normalCycles_computeTensor(
{
typename PFP::REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(col.getMap(), e, position);
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), e, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle * (1 / ev.norm());
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle * (1.0 / ev.norm());
}
// collect edges on the border
......@@ -556,7 +556,7 @@ void normalCycles_computeTensor(
typename PFP::REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(col.getMap(), d, position);
typename PFP::REAL alpha = col.borderEdgeRatio(d, position);
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), d, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle * (1 / ev.norm()) * alpha;
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle * (1.0 / ev.norm()) * alpha;
}
tensor /= col.computeArea(position);
......@@ -575,7 +575,7 @@ void normalCycles_computeTensor(
for (Edge e : col.getInsideEdges())
{
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), e, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[e] * (1 / ev.norm());
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[e] * (1.0 / ev.norm());
}
// collect edges on the border
......@@ -583,7 +583,7 @@ void normalCycles_computeTensor(
{
typename PFP::REAL alpha = col.borderEdgeRatio(d, position);
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), d, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[d] * (1 / ev.norm()) * alpha;
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[d] * (1.0 / ev.norm()) * alpha;
}
tensor /= col.computeArea(position);
......@@ -603,7 +603,7 @@ void normalCycles_computeTensor(
for (Edge e : col.getInsideEdges())
{
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), e, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[e] * (1 / ev.norm());
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[e] * (1.0 / ev.norm());
}
// collect edges on the border
......@@ -611,7 +611,7 @@ void normalCycles_computeTensor(
{
typename PFP::REAL alpha = col.borderEdgeRatio(d, position);
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), d, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[d] * (1 / ev.norm()) * alpha;
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[d] * (1.0 / ev.norm()) * alpha;
}
tensor /= col.computeArea(position, edgearea);
......
......@@ -116,7 +116,7 @@ template <typename VEC>
typename VEC::DATA_TYPE BoundingBox<VEC>::diagSize() const
{
assert(m_initialized || !"Bounding box not initialized");
return (m_pMax - m_pMin).norm() ;
return VEC::DATA_TYPE((m_pMax - m_pMin).norm());
}
template <typename VEC>
......
......@@ -285,7 +285,7 @@ REAL
QuadricNd<REAL,N>::evaluate(const VECN& v) const
{
Geom::Vector<N, double> v_d = v ;
return v_d*A*v_d + 2.*(b*v_d) + c ;
return v_d*(A*v_d) + 2.0*(b*v_d) + c ;
}
template <typename REAL, unsigned int N>
......
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