diff --git a/Apps/Tuto/tuto2.h b/Apps/Tuto/tuto2.h index 075a9462a22d807f5318e6d92c6a0fdd4cea91d4..a7ade386bee6e96dd5467bdd793b65ea9817b6ac 100644 --- a/Apps/Tuto/tuto2.h +++ b/Apps/Tuto/tuto2.h @@ -47,7 +47,6 @@ using namespace CGoGN ; * Ajouter les widgets necessaires, mettre des noms clairs pour * les utiliser dans le .cpp (pour les call back principalement) */ - class MyQT: public Utils::QT::SimpleQT { Q_OBJECT diff --git a/include/Algo/Decimation/decimation.hpp b/include/Algo/Decimation/decimation.hpp index d89235c309ed67f85d66dd77c5bb55ffc01b5ebe..1c9911c9285b5a0f00bdbdf67990f8f8c561b6ed 100644 --- a/include/Algo/Decimation/decimation.hpp +++ b/include/Algo/Decimation/decimation.hpp @@ -149,7 +149,7 @@ void decimate( while(!finished) { CGoGNout << "Countdown : " ; - CGoGNout << std::setprecision(8) << (nbVertices - nbWantedVertices) << "\r" << std::flush; + CGoGNout << std::setprecision(8) << (nbVertices - nbWantedVertices) << "\r" << /* flush */ CGoGNendl ; if(!selector->nextEdge(d)) { CGoGNout << CGoGNendl << "out" << CGoGNendl ; diff --git a/include/Algo/Export/export.hpp b/include/Algo/Export/export.hpp index e8fcac62ae435d2f614cc8f48dfa84a2b7e2aac1..628a17f58c89bfc23d568f522962c56bea4ecf5c 100644 --- a/include/Algo/Export/export.hpp +++ b/include/Algo/Export/export.hpp @@ -86,28 +86,28 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons } } - out << "ply" << CGoGNendl ; - out << "format ascii 1.0" << CGoGNendl ; - out << "comment no comment" << CGoGNendl ; - out << "element vertex " << vertices.size() << CGoGNendl ; - out << "property float x" << CGoGNendl ; - out << "property float y" << CGoGNendl ; - out << "property float z" << CGoGNendl ; - out << "element face " << facesSize.size() << CGoGNendl ; - out << "property list uchar int vertex_indices" << CGoGNendl ; - out << "end_header" << CGoGNendl ; + out << "ply" << std::endl ; + out << "format ascii 1.0" << std::endl ; + out << "comment no comment" << std::endl ; + out << "element vertex " << vertices.size() << std::endl ; + out << "property float x" << std::endl ; + out << "property float y" << std::endl ; + out << "property float z" << std::endl ; + out << "element face " << facesSize.size() << std::endl ; + out << "property list uchar int vertex_indices" << std::endl ; + out << "end_header" << std::endl ; for(unsigned int i = 0; i < vertices.size(); ++i) { const VEC3& v = position[vertices[i]] ; - out << v[0] << " " << v[1] << " " << v[2] << CGoGNendl ; + out << v[0] << " " << v[1] << " " << v[2] << std::endl ; } for(unsigned int i = 0; i < facesSize.size(); ++i) { out << facesSize[i] ; for(unsigned int j = 0; j < facesIdx[i].size(); ++j) out << " " << facesIdx[i][j] ; - out << CGoGNendl ; + out << std::endl ; } out.close() ; @@ -164,20 +164,20 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons } } - out << "OFF" << CGoGNendl ; - out << vertices.size() << " " << facesSize.size() << " " << 0 << CGoGNendl ; + out << "OFF" << std::endl ; + out << vertices.size() << " " << facesSize.size() << " " << 0 << std::endl ; for(unsigned int i = 0; i < vertices.size(); ++i) { const VEC3& v = position[vertices[i]] ; - out << v[0] << " " << v[1] << " " << v[2] << CGoGNendl ; + out << v[0] << " " << v[1] << " " << v[2] << std::endl ; } for(unsigned int i = 0; i < facesSize.size(); ++i) { out << facesSize[i] ; for(unsigned int j = 0; j < facesIdx[i].size(); ++j) out << " " << facesIdx[i][j] ; - out << CGoGNendl ; + out << std::endl ; } out.close() ; @@ -219,7 +219,6 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position, verticesBuffer.push_back(vert[0]); verticesBuffer.push_back(vert[1]); verticesBuffer.push_back(vert[2]); -// CGoGNout << vert<< CGoGNendl; } indicesBuffer.push_back(tableVertLab[e]); e = the_map.phi1(e); @@ -227,13 +226,6 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position, } } -// for (int i=0; i< indicesBuffer.size(); ++i) -// { -// CGoGNout << indicesBuffer[i]<<", "<< CGoGNendl; -// if (i%3==0) -// CGoGNout << CGoGNendl; -// } - // Save the file using the OpenCTM API CTMexporter ctm; @@ -311,43 +303,43 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P } } - out << "ply" << CGoGNendl ; - out << "format ascii 1.0" << CGoGNendl ; - out << "comment ply PTM (F. Larue format)" << CGoGNendl ; - out << "element vertex " << vertices.size() << CGoGNendl ; - out << "property float x" << CGoGNendl ; - out << "property float y" << CGoGNendl ; - out << "property float z" << CGoGNendl ; - out << "property float tx" << CGoGNendl ; - out << "property float ty" << CGoGNendl ; - out << "property float tz" << CGoGNendl ; - out << "property float bx" << CGoGNendl ; - out << "property float by" << CGoGNendl ; - out << "property float bz" << CGoGNendl ; - out << "property float nx" << CGoGNendl ; - out << "property float ny" << CGoGNendl ; - out << "property float nz" << CGoGNendl ; - out << "property float L1_a" << CGoGNendl ; - out << "property float L1_b" << CGoGNendl ; - out << "property float L1_c" << CGoGNendl ; - out << "property float L1_d" << CGoGNendl ; - out << "property float L1_e" << CGoGNendl ; - out << "property float L1_f" << CGoGNendl ; - out << "property float L2_a" << CGoGNendl ; - out << "property float L2_b" << CGoGNendl ; - out << "property float L2_c" << CGoGNendl ; - out << "property float L2_d" << CGoGNendl ; - out << "property float L2_e" << CGoGNendl ; - out << "property float L2_f" << CGoGNendl ; - out << "property float L3_a" << CGoGNendl ; - out << "property float L3_b" << CGoGNendl ; - out << "property float L3_c" << CGoGNendl ; - out << "property float L3_d" << CGoGNendl ; - out << "property float L3_e" << CGoGNendl ; - out << "property float L3_f" << CGoGNendl ; - out << "element face " << nbf << CGoGNendl ; - out << "property list uchar int vertex_indices" << CGoGNendl ; - out << "end_header" << CGoGNendl ; + out << "ply" << std::endl ; + out << "format ascii 1.0" << std::endl ; + out << "comment ply PTM (F. Larue format)" << std::endl ; + out << "element vertex " << vertices.size() << std::endl ; + out << "property float x" << std::endl ; + out << "property float y" << std::endl ; + out << "property float z" << std::endl ; + out << "property float tx" << std::endl ; + out << "property float ty" << std::endl ; + out << "property float tz" << std::endl ; + out << "property float bx" << std::endl ; + out << "property float by" << std::endl ; + out << "property float bz" << std::endl ; + out << "property float nx" << std::endl ; + out << "property float ny" << std::endl ; + out << "property float nz" << std::endl ; + out << "property float L1_a" << std::endl ; + out << "property float L1_b" << std::endl ; + out << "property float L1_c" << std::endl ; + out << "property float L1_d" << std::endl ; + out << "property float L1_e" << std::endl ; + out << "property float L1_f" << std::endl ; + out << "property float L2_a" << std::endl ; + out << "property float L2_b" << std::endl ; + out << "property float L2_c" << std::endl ; + out << "property float L2_d" << std::endl ; + out << "property float L2_e" << std::endl ; + out << "property float L2_f" << std::endl ; + out << "property float L3_a" << std::endl ; + out << "property float L3_b" << std::endl ; + out << "property float L3_c" << std::endl ; + out << "property float L3_d" << std::endl ; + out << "property float L3_e" << std::endl ; + out << "property float L3_f" << std::endl ; + out << "element face " << nbf << std::endl ; + out << "property list uchar int vertex_indices" << std::endl ; + out << "end_header" << std::endl ; for(unsigned int i = 0; i < vertices.size(); ++i) { @@ -358,7 +350,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P out << frame[2][vi][0] << " " << frame[2][vi][1] << " " << frame[2][vi][2] << " " ; out << colorPTM[0][vi][0] << " " << colorPTM[1][vi][0] << " " << colorPTM[2][vi][0] << " " << colorPTM[3][vi][0] << " " << colorPTM[4][vi][0] << " " << colorPTM[5][vi][0] <<" " ; out << colorPTM[0][vi][1] << " " << colorPTM[1][vi][1] << " " << colorPTM[2][vi][1] << " " << colorPTM[3][vi][1] << " " << colorPTM[4][vi][1] << " " << colorPTM[5][vi][1] <<" " ; - out << colorPTM[0][vi][2] << " " << colorPTM[1][vi][2] << " " << colorPTM[2][vi][2] << " " << colorPTM[3][vi][2] << " " << colorPTM[4][vi][2] << " " << colorPTM[5][vi][2] << CGoGNendl ; + out << colorPTM[0][vi][2] << " " << colorPTM[1][vi][2] << " " << colorPTM[2][vi][2] << " " << colorPTM[3][vi][2] << " " << colorPTM[4][vi][2] << " " << colorPTM[5][vi][2] << std::endl ; } std::vector::iterator it = faces.begin(); @@ -368,7 +360,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P out << nbe ; for(unsigned int j = 0; j < nbe; ++j) out << " " << *it++; - out << CGoGNendl ; + out << std::endl ; } out.close() ; diff --git a/include/Algo/Import/importInESS.hpp b/include/Algo/Import/importInESS.hpp index a233271e96f403335c2d147eff5b7790ffcb4833..8536fe26746485aaf6dcd6abeb4af97b4febcea8 100644 --- a/include/Algo/Import/importInESS.hpp +++ b/include/Algo/Import/importInESS.hpp @@ -56,8 +56,7 @@ typename PFP::VEC3 stringToEmb(std::string s) return coord; } - -unsigned int gcd(unsigned int a, unsigned int b) +inline unsigned int gcd(unsigned int a, unsigned int b) { while ( true ) diff --git a/include/Algo/ProgressiveMesh/pmesh.h b/include/Algo/ProgressiveMesh/pmesh.h index 29c8d2c5b304775edd77cb3f41e9a565023268ea..f18f4e426af0d4511fc995b56821591e426cce3f 100644 --- a/include/Algo/ProgressiveMesh/pmesh.h +++ b/include/Algo/ProgressiveMesh/pmesh.h @@ -28,6 +28,7 @@ #include "Algo/ProgressiveMesh/vsplit.h" #include "Algo/Decimation/selector.h" +#include "Algo/Decimation/edgeSelector.h" #include "Algo/Decimation/geometryApproximator.h" #include "Algo/Decimation/geometryPredictor.h" #include "Algo/Decimation/lightfieldApproximator.h" diff --git a/include/Algo/ProgressiveMesh/pmesh.hpp b/include/Algo/ProgressiveMesh/pmesh.hpp index a9869bce2106414b896a26b2a17b227890ee7b13..c7b06d8be6d46f23dabe1d6754749383a5362091 100644 --- a/include/Algo/ProgressiveMesh/pmesh.hpp +++ b/include/Algo/ProgressiveMesh/pmesh.hpp @@ -41,7 +41,7 @@ ProgressiveMesh::ProgressiveMesh( ) : m_map(map), positionsTable(position), inactiveMarker(inactive), dartSelect(inactiveMarker) { - CGoGNout << " creating approximator and predictor.." << std::flush ; + CGoGNout << " creating approximator and predictor.." << /* flush */ CGoGNendl ; switch(a) { case Algo::Decimation::A_QEM : { @@ -70,17 +70,10 @@ ProgressiveMesh::ProgressiveMesh( m_predictors.push_back(pred) ; m_approximators.push_back(new Algo::Decimation::Approximator_MidEdge(m_map, positionsTable, pred)) ; break ; } - case Algo::Decimation::A_LightfieldFull : { - m_approximators.push_back(new Algo::Decimation::Approximator_QEM(m_map, positionsTable)) ; - AttributeHandler > frame = m_map.template getAttribute >(VERTEX_ORBIT, "frame") ; - AttributeHandler > RGBfunctions = m_map.template getAttribute >(VERTEX_ORBIT, "RGBfunctions") ; - m_approximators.push_back(new Algo::Decimation::Approximator_Frame(m_map, frame)) ; - m_approximators.push_back(new Algo::Decimation::Approximator_RGBfunctions(m_map, RGBfunctions)) ; - break ; } } CGoGNout << "..done" << CGoGNendl ; - CGoGNout << " creating selector.." << std::flush ; + CGoGNout << " creating selector.." << /* flush */ CGoGNendl ; switch(s) { case Algo::Decimation::S_MapOrder : { @@ -101,15 +94,12 @@ ProgressiveMesh::ProgressiveMesh( case Algo::Decimation::S_Curvature : { m_selector = new Algo::Decimation::EdgeSelector_Curvature(m_map, positionsTable, m_approximators, dartSelect) ; break ; } - case Algo::Decimation::S_Lightfield : { - m_selector = new Algo::Decimation::EdgeSelector_Lightfield(map, positionsTable, m_approximators, dartSelect) ; - break ; } } CGoGNout << "..done" << CGoGNendl ; m_initOk = true ; - CGoGNout << " initializing approximators.." << std::flush ; + CGoGNout << " initializing approximators.." << /* flush */ CGoGNendl ; for(typename std::vector*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it) { if(! (*it)->init()) @@ -119,13 +109,13 @@ ProgressiveMesh::ProgressiveMesh( } CGoGNout << "..done" << CGoGNendl ; - CGoGNout << " initializing predictors.." << std::flush ; + CGoGNout << " initializing predictors.." << /* flush */ CGoGNendl ; for(typename std::vector*>::iterator it = m_predictors.begin(); it != m_predictors.end(); ++it) if(! (*it)->init()) m_initOk = false ; CGoGNout << "..done" << CGoGNendl ; - CGoGNout << " initializing selector.." << std::flush ; + CGoGNout << " initializing selector.." << /* flush */ CGoGNendl ; m_initOk = m_selector->init() ; CGoGNout << "..done" << CGoGNendl ; @@ -155,7 +145,7 @@ void ProgressiveMesh::createPM(unsigned int percentWantedVertices) { unsigned int nbVertices = m_map.getNbOrbits(VERTEX_ORBIT) ; unsigned int nbWantedVertices = nbVertices * percentWantedVertices / 100 ; - CGoGNout << " creating PM (" << nbVertices << " vertices).." << std::flush ; + CGoGNout << " creating PM (" << nbVertices << " vertices).." << /* flush */ CGoGNendl ; bool finished = false ; Dart d ; @@ -535,7 +525,7 @@ void ProgressiveMesh::calculCourbeDebitDistortion() float distance; Point p; - CGoGNout << "calcul de la courbe débit distortion " << std::flush; + CGoGNout << "calcul de la courbe débit distortion " << CGoGNendl; // get original detail vectors for(unsigned int i = 0; i < m_splits.size(); ++i) @@ -573,7 +563,7 @@ void ProgressiveMesh::calculCourbeDebitDistortion() courbe.push_back(p); // returns to coarse mesh gotoLevel(nbSplits()); - CGoGNout << "..." << std::flush; + CGoGNout << "..." << CGoGNendl; } q.erase(); } diff --git a/include/Algo/ProgressiveMesh/vsplit.h b/include/Algo/ProgressiveMesh/vsplit.h index 5171ca593fc7ae55143773da2446e608458ae36d..a9c374012b8de7984505482ff102ae0a3bcc4fbc 100644 --- a/include/Algo/ProgressiveMesh/vsplit.h +++ b/include/Algo/ProgressiveMesh/vsplit.h @@ -34,7 +34,6 @@ namespace Algo namespace PMesh { - template class VSplit { @@ -98,7 +97,6 @@ public: } } ; - } //namespace PMesh } //namespace Algo diff --git a/include/Geometry/intersection.hpp b/include/Geometry/intersection.hpp index 035592355c64c7997a417d4de889456b1956c1e6..57e274b1595fb18572f60bb70bc148fa26757b04 100644 --- a/include/Geometry/intersection.hpp +++ b/include/Geometry/intersection.hpp @@ -284,8 +284,7 @@ Intersection intersectionSegmentTriangle(const VEC3& PA, const VEC3& PB, const V template Intersection intersectPlaneRay(const PLANE3D& pl,const VEC3& p1,const VEC3& dir, VEC3& Inter) { - typename VEC3::DATA_TYPE isect; - isect = (pl.normal()*(pl.normal()*pl.d()-p1)) / (pl.normal()*dir); + typename VEC3::DATA_TYPE isect = (pl.normal() * (pl.normal()*pl.d()-p1)) / (pl.normal()*dir); if(0.0f <= isect) { diff --git a/include/Utils/qtSimple.h b/include/Utils/qtSimple.h index 2ef7ee76d01beabd5cbde2a6d4007c4fa95afd93..e3bf260273d0ce57c8d72fabb0a2e37bc40ce4ed 100644 --- a/include/Utils/qtSimple.h +++ b/include/Utils/qtSimple.h @@ -36,7 +36,6 @@ #include "Geometry/vector_gen.h" namespace CGoGN { namespace Utils { class GLSLShader; } } -//namespace CGoGN { namespace Geom { class Vec3f; } } namespace CGoGN { @@ -173,6 +172,11 @@ public: */ void setParamObject(float width, float* pos) { m_glWidget->setParamObject(width, pos); } + /** + * set focal + */ + void setFocal(float f) { m_glWidget->setFocal(f); } + /** * get the mouse position in GL widget */ @@ -310,7 +314,7 @@ public: * @param dir base directory * @param filters file filters (syntax: "label1 (filter1);; label2 (filter2);; ...") */ - std::string selectFile(const std::string& title = "open file", const std::string& dir = ".", const std::string& filters = "all (*.*)"); + std::string selectFile(const std::string& title = "open file", const std::string& dir = ".", const std::string& filters = "all (*.*)"); public slots: virtual void cb_New() { std::cerr << "callback not implemented" << std::endl; } diff --git a/include/Utils/qtgl.h b/include/Utils/qtgl.h index 96c592fabe89426643874cf7a254225fe12db685..a947426fd12f3ee67ed1ae940c94fbb43b85052c 100644 --- a/include/Utils/qtgl.h +++ b/include/Utils/qtgl.h @@ -71,8 +71,6 @@ protected: int m_current_button; int beginx; int beginy; -// float curquat[4]; -// float lastquat[4]; int newModel; int moving; diff --git a/include/Utils/qtui.h b/include/Utils/qtui.h index 684b5e368505f56000b0bb62aafeb33be37744cb..58371de450c345e7f75fe59cdb7f227bac0aef16 100644 --- a/include/Utils/qtui.h +++ b/include/Utils/qtui.h @@ -34,14 +34,16 @@ namespace Utils namespace QT { -class uiDockInterface: public QDockWidget, public Ui::DockWidget +class uiDockInterface : public QDockWidget, public Ui::DockWidget { public: uiDockInterface() { setupUi(this); } }; -} -} -} +} // namespace QT + +} // namespace Utils + +} // namespace CGoGN #endif diff --git a/include/Utils/quadricRGBfunctions.h b/include/Utils/quadricRGBfunctions.h index fb0d299a17c74032237e9b10654e53d3399de3a7..9e8b1647f4f5724bf998b88715e17f3dae968521 100644 --- a/include/Utils/quadricRGBfunctions.h +++ b/include/Utils/quadricRGBfunctions.h @@ -72,11 +72,11 @@ public: void zero () ; friend std::ostream& operator<< (std::ostream &out, const QuadricRGBfunctions& q) { - out << "quadricRGBf : " << CGoGNendl ; - out << "q.A" << "= " << q.A << CGoGNendl ; + out << "quadricRGBf : " << std::endl ; + out << "q.A" << "= " << q.A << std::endl ; for (unsigned int i = 0 ; i < 3 ; ++i) { - out << "q.b["< 3.0f) - df = 3.0f; + if (df > 5.0f) + df = 5.0f; if (df < 0.2f) df = 0.2f; @@ -180,7 +180,7 @@ void GLWidget::mouseMoveEvent(QMouseEvent* event) break; case Qt::MidButton: { - float wl = -0.2f * FAR_PLANE / foc; + float wl = -0.5f * FAR_PLANE / foc; m_cbs->trans_z() -= wl / W * (x - beginx); m_cbs->trans_z() -= wl / H * (y - beginy); } @@ -209,7 +209,7 @@ void GLWidget::mouseMoveEvent(QMouseEvent* event) void GLWidget::wheelEvent ( QWheelEvent * event ) { - float wl = -0.02f * FAR_PLANE / foc; + float wl = -0.05f * FAR_PLANE / foc; if (event->delta() > 0) m_cbs->trans_z() += wl;