Commit 7a2fdd6b authored by Sylvain Thery's avatar Sylvain Thery

restore volumeExplorer

parent bd4f72f5
...@@ -29,12 +29,8 @@ ...@@ -29,12 +29,8 @@
#include "Algo/Modelisation/polyhedron.h" #include "Algo/Modelisation/polyhedron.h"
#include "Algo/Import/import.h" #include "Algo/Import/import.h"
#include "Algo/Geometry/volume.h" #include "Algo/Geometry/volume.h"
#include "Algo/Modelisation/tetrahedralization.h"
#include "Algo/Geometry/area.h" #include "Algo/Geometry/area.h"
#include "Utils/chrono.h"
#include "Algo/Export/exportVol.h" #include "Algo/Export/exportVol.h"
MAP myMap; MAP myMap;
...@@ -275,6 +271,14 @@ void MyQT::cb_redraw() ...@@ -275,6 +271,14 @@ void MyQT::cb_redraw()
m_frame->draw(); m_frame->draw();
m_PlanePick->draw(); m_PlanePick->draw();
} }
m_nbFrames++;
if (m_nbFrames >=40)
{
std::cout << 40000.0/m_frame_ch.elapsed()<< " fps"<<std::endl;
m_nbFrames = 0;
m_frame_ch.start();
}
} }
...@@ -385,23 +389,6 @@ int main(int argc, char **argv) ...@@ -385,23 +389,6 @@ int main(int argc, char **argv)
std::string filename(argv[1]); std::string filename(argv[1]);
size_t pos = filename.rfind("."); // position of "." in filename size_t pos = filename.rfind("."); // position of "." in filename
std::string extension = filename.substr(pos); std::string extension = filename.substr(pos);
/*
if(extension == std::string(".off"))
{
if(!Algo::Volume::Import::importMeshToExtrude<PFP>(myMap, filename, attrNames))
{
std::cerr << "could not import " << filename << std::endl ;
return 1;
}
else
{
position = myMap.getAttribute<VEC3, VERTEX>(attrNames[0]) ;
myMap.closeMap();
}
}
else
{
*/
if(extension == std::string(".mapbin")) if(extension == std::string(".mapbin"))
{ {
...@@ -421,36 +408,20 @@ int main(int argc, char **argv) ...@@ -421,36 +408,20 @@ int main(int argc, char **argv)
color = myMap.addAttribute<VEC3, VOLUME, MAP>("colorVol"); color = myMap.addAttribute<VEC3, VOLUME, MAP>("colorVol");
TraversorCell<MAP, VOLUME> tra(myMap); TraversorCell<MAP, VOLUME> tra(myMap);
float maxV = 0.0f; float maxV = 0.0f;
for (Dart d = tra.begin(); d != tra.end(); d = tra.next()) for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
{ {
float v = Algo::Geometry::convexPolyhedronVolume<PFP>(myMap, d, position);
// float v = Algo::Geometry::tetrahedronVolume<PFP>(myMap, d, position);
color[d] = PFP::VEC3(1.0,0,0);
// if (v>maxV)
// maxV=v;
if(myMap.isVolumeIncidentToBoundary(d))
color[d] = PFP::VEC3(1,0.41,0.706);
//else
// color[d] = PFP::VEC3(1.0,0,0);
/*
float v = Algo::Geometry::tetrahedronVolume<PFP>(myMap, d, position);
color[d] = VEC3(v,0,0); color[d] = VEC3(v,0,0);
if (v>maxV) if (v>maxV)
maxV=v; maxV=v;
// if(myMap.isVolumeIncidentToBoundary(d))
// color[d] = VEC3(0,0,0);
// else
color[d] = VEC3(v,0,0);
} }
for (unsigned int i = color.begin(); i != color.end(); color.next(i)) for (unsigned int i = color.begin(); i != color.end(); color.next(i))
{ {
color[i][0] /= maxV; color[i][0] /= maxV;
color[i][2] = 1.0f - color[i][0]; color[i][2] = 1.0f - color[i][0];
*/
} }
} }
...@@ -458,7 +429,7 @@ int main(int argc, char **argv) ...@@ -458,7 +429,7 @@ int main(int argc, char **argv)
{ {
position = myMap.addAttribute<VEC3, VERTEX, MAP>("position"); position = myMap.addAttribute<VEC3, VERTEX, MAP>("position");
int nb = 32; int nb = 16;
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, nb, nb, nb); Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, nb, nb, nb);
cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f); cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
...@@ -472,9 +443,6 @@ int main(int argc, char **argv) ...@@ -472,9 +443,6 @@ int main(int argc, char **argv)
TraversorW<MAP> tra(myMap); TraversorW<MAP> tra(myMap);
for (Dart d = tra.begin(); d != tra.end(); d = tra.next()) for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
color[d] = position[d] + VEC3(0.5,0.5,0.5); color[d] = position[d] + VEC3(0.5,0.5,0.5);
// Algo::Volume::Export::exportMSH<PFP>(myMap,position,"/tmp/test2.msh");
// Algo::Volume::Export::exportNAS<PFP>(myMap,position,"/tmp/test1.nas");
// Algo::Volume::Export::exportVTU<PFP>(myMap,position,"/tmp/test3.vtu");
} }
myMap.check(); myMap.check();
...@@ -513,37 +481,30 @@ int main(int argc, char **argv) ...@@ -513,37 +481,30 @@ int main(int argc, char **argv)
sqt.show(); sqt.show();
dock.slider_explode->setValue(80); dock.slider_explode->setValue(80);
dock.slider_explode_face->setValue(80); dock.slider_explode_face->setValue(100);
sqt.clipping_onoff(true); sqt.clipping_onoff(true);
Utils::Chrono ch; // Utils::Chrono ch;
// ch.start();
// Vertex v(myMap.begin()); // float vol = Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
// VEC3 p = Algo::Volume::Geometry::vertexNeighborhoodCentroid<PFP>(myMap,v,position); // vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
// vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
// Vol w(myMap.begin()); // vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
// VEC3 q = Algo::Surface::Geometry::volumeCentroid<PFP>(myMap,w,position); // std::cout << ch.elapsed()<< " ms // val="<<vol<< std::endl;
ch.start(); // std::cout << "Compute Volume ->"<< std::endl;
float vol = Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position); // ch.start();
vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position); // vol = Algo::Geometry::totalVolume<PFP>(myMap, position);
vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position); // std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position); // ch.start();
std::cout << ch.elapsed()<< " ms // val="<<vol<< std::endl; // vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
// std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
std::cout << "Compute Volume ->"<< std::endl; // ch.start();
ch.start(); // vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
vol = Algo::Geometry::totalVolume<PFP>(myMap, position); // std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl; // ch.start();
ch.start(); // vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
vol += Algo::Geometry::totalVolume<PFP>(myMap, position); // std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
ch.start();
vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
ch.start();
vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
// et on attend la fin. // et on attend la fin.
return app.exec(); return app.exec();
......
...@@ -36,14 +36,14 @@ ...@@ -36,14 +36,14 @@
#include "Algo/Render/GL2/explodeVolumeRender.h" #include "Algo/Render/GL2/explodeVolumeRender.h"
#include "Utils/cgognStream.h" #include "Utils/cgognStream.h"
#include "Utils/Qt/qtSimple.h" #include "Utils/Qt/qtQGLV.h"
#include "Utils/frameManipulator.h" #include "Utils/frameManipulator.h"
#include "ui_volumeExplorer.h" #include "ui_volumeExplorer.h"
#include "Utils/Qt/qtui.h" #include "Utils/Qt/qtui.h"
#include "Algo/Export/exportVol.h" #include "Algo/Export/exportVol.h"
#include "Utils/chrono.h"
using namespace CGoGN ; using namespace CGoGN ;
...@@ -66,7 +66,7 @@ using namespace CGoGN ; ...@@ -66,7 +66,7 @@ using namespace CGoGN ;
* Ajouter les widgets necessaires, mettre des noms clairs pour * Ajouter les widgets necessaires, mettre des noms clairs pour
* les utiliser dans le .cpp (pour les call back principalement) * les utiliser dans le .cpp (pour les call back principalement)
*/ */
class MyQT: public Utils::QT::SimpleQT class MyQT: public Utils::QT::SimpleQGLV
{ {
Q_OBJECT Q_OBJECT
...@@ -95,6 +95,8 @@ class MyQT: public Utils::QT::SimpleQT ...@@ -95,6 +95,8 @@ class MyQT: public Utils::QT::SimpleQT
// shader of toporender3 // shader of toporender3
Utils::ClippingShader* m_sh1; Utils::ClippingShader* m_sh1;
Utils::ClippingShader* m_sh2; Utils::ClippingShader* m_sh2;
Utils::Chrono m_frame_ch;
unsigned int m_nbFrames;
public: public:
float m_WidthObj; float m_WidthObj;
...@@ -110,7 +112,8 @@ public: ...@@ -110,7 +112,8 @@ public:
hide_clipping(false), hide_clipping(false),
m_topo_render(NULL), m_topo_render(NULL),
m_explode_render(NULL), m_explode_render(NULL),
m_explode_factor(0.8f) m_explode_factor(0.8f),
m_nbFrames(0)
{} {}
protected: protected:
......
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