Commit 4830f7f3 authored by Sylvain Thery's avatar Sylvain Thery

forgottent commited files for MR & new orbits

parent 10aeeaff
...@@ -72,3 +72,9 @@ QT4_WRAP_CPP( clipping_moc ../clipping.h ) ...@@ -72,3 +72,9 @@ QT4_WRAP_CPP( clipping_moc ../clipping.h )
add_executable( clippingD ../clipping.cpp ${clipping_ui} ${clipping_moc}) add_executable( clippingD ../clipping.cpp ${clipping_ui} ${clipping_moc})
target_link_libraries( clippingD target_link_libraries( clippingD
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} ) ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( volumeExplorer_ui ../volumeExplorer.ui )
QT4_WRAP_CPP( volumeExplorer_moc ../volumeExplorer.h )
add_executable( volumeExplorerD ../volumeExplorer.cpp ${volumeExplorer_ui} ${volumeExplorer_moc})
target_link_libraries( volumeExplorerD
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
\ No newline at end of file
...@@ -64,3 +64,10 @@ QT4_WRAP_CPP( clipping_moc ../clipping.h ) ...@@ -64,3 +64,10 @@ QT4_WRAP_CPP( clipping_moc ../clipping.h )
add_executable( clipping ../clipping.cpp ${clipping_ui} ${clipping_moc}) add_executable( clipping ../clipping.cpp ${clipping_ui} ${clipping_moc})
target_link_libraries( clipping target_link_libraries( clipping
${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} ) ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( volumeExplorer_ui ../volumeExplorer.ui )
QT4_WRAP_CPP( volumeExplorer_moc ../volumeExplorer.h )
add_executable( volumeExplorer ../volumeExplorer.cpp ${volumeExplorer_ui} ${volumeExplorer_moc})
target_link_libraries( volumeExplorer
${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
\ No newline at end of file
...@@ -37,9 +37,9 @@ SimpleGMap3::SimpleGMap3() ...@@ -37,9 +37,9 @@ SimpleGMap3::SimpleGMap3()
Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position); Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(3,1,1); Dart d = primCat.hexaGrid_topo(3,1,1);
primCat.embedHexaGrid(2,1,1); primCat.embedHexaGrid(2,1,1);
std::cout << "AAA"<< std::endl;
myMap.check(); myMap.check();
std::cout << "AAA"<< std::endl;
DartMarker markOrient(myMap); DartMarker markOrient(myMap);
std::vector<Dart> orient; std::vector<Dart> orient;
FunctorStore fs(orient); FunctorStore fs(orient);
...@@ -47,11 +47,13 @@ SimpleGMap3::SimpleGMap3() ...@@ -47,11 +47,13 @@ SimpleGMap3::SimpleGMap3()
d = 49; d = 49;
myMap.foreach_dart_of_oriented_volume(d, fs); myMap.foreach_dart_of_oriented_volume(d, fs);
std::cout << "AAA"<< std::endl;
for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it) for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it)
markOrient.mark(*it); markOrient.mark(*it);
SelectorMarked sm(markOrient); SelectorMarked sm(markOrient);
std::cout << "AAA"<< std::endl;
Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap, position, sm); Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap, position, sm);
for(unsigned int i = position.begin() ; i != position.end() ; position.next(i)) for(unsigned int i = position.begin() ; i != position.end() ; position.next(i))
...@@ -86,6 +88,7 @@ SimpleGMap3::SimpleGMap3() ...@@ -86,6 +88,7 @@ SimpleGMap3::SimpleGMap3()
myMap.unsewVolumes(d); myMap.unsewVolumes(d);
myMap.check(); myMap.check();
} }
void SimpleGMap3::initGUI() void SimpleGMap3::initGUI()
......
...@@ -53,6 +53,12 @@ add_executable( tuto5 tuto5.cpp ${tuto5_ui} ${tuto5_moc}) ...@@ -53,6 +53,12 @@ add_executable( tuto5 tuto5.cpp ${tuto5_ui} ${tuto5_moc})
target_link_libraries( tuto5 target_link_libraries( tuto5
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} ) ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( tuto_orbits_ui tuto_orbits.ui )
QT4_WRAP_CPP(tuto_orbits_moc tuto_orbits.h)
add_executable( tuto_orbits tuto_orbits.cpp ${tuto_orbits_ui} ${tuto_orbits_moc})
target_link_libraries( tuto_orbits
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
#add_executable( tuto_subdivision tuto_subdivision.cpp) #add_executable( tuto_subdivision tuto_subdivision.cpp)
#target_link_libraries( tuto_subdivision #target_link_libraries( tuto_subdivision
......
...@@ -55,67 +55,94 @@ int main(int argc, char **argv) ...@@ -55,67 +55,94 @@ int main(int argc, char **argv)
return app.exec(); return app.exec();
} }
Dart xd1;
void MyQT::traverseMap() void MyQT::traverseMap()
{ {
DartMarker m1(myMap);
DartMarker m2(myMap);
myMap.rdfi(myMap.begin(),m1,m2);
//traverse cells of map using topological markers on darts m1.unmarkAll();
CGoGNout << "Traverse with DartMarkers:"<< CGoGNendl;
DartMarker dmV(myMap);
DartMarker dmE(myMap);
DartMarker dmF(myMap);
for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
{
if (!dmV.isMarked(d))
{
CGoGNout << "Vertex of dart "<<d<<CGoGNendl;
dmV.markOrbit(VERTEX,d);
}
if (!dmE.isMarked(d))
{
CGoGNout << "Edgee of dart "<<d<<CGoGNendl;
dmE.markOrbit(EDGE,d);
}
if (!dmF.isMarked(d))
{
CGoGNout << "Face of dart "<<d<<CGoGNendl;
dmF.markOrbit(FACE,d);
}
}
m1.markOrbit(VOLUME,xd1);
// traverses cells of map with markers on embedded cells. // render the topo of the map without boundary darts
// More efficients but more memory costly if cells are not already embedded. SelectorDartNoBoundary<PFP::MAP> nb(myMap);
// Avoid using construction of objects not ell embedded m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f,nb);
CGoGNout << "========================="<< CGoGNendl;
CGoGNout << "Traverse with CellMarkers:"<< CGoGNendl;
CellMarker cmV(myMap,VERTEX);
CellMarker cmE(myMap,EDGE);
CellMarker cmF(myMap,FACE);
for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d)) for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
{ {
if (!cmV.isMarked(d)) if (m2.isMarked(d))
{
CGoGNout << "Vertex of dart "<<d<<CGoGNendl;
cmV.mark(d);
}
if (!cmE.isMarked(d))
{ {
CGoGNout << "Edgee of dart "<<d<<CGoGNendl; m_render_topo->setDartColor(d,1.0f,0.0f,0.0f);
cmE.mark(d);
} }
if (!cmF.isMarked(d)) if (m1.isMarked(d))
{ {
CGoGNout << "Face of dart "<<d<<CGoGNendl; m_render_topo->setDartColor(d,0.0f,1.0f,0.0f);
cmF.mark(d);
} }
} }
// markers are cleaned and released at destruction of DartMarkers & CellMarkers //
// DartMarkerStore should be used if few darts are traversed //
// DartMarkerNoUnmark can be use if you want to manage unmarking yourself // //traverse cells of map using topological markers on darts
//
// CGoGNout << "Traverse with DartMarkers:"<< CGoGNendl;
// DartMarker dmV(myMap);
// DartMarker dmE(myMap);
// DartMarker dmF(myMap);
// for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
// {
// if (!dmV.isMarked(d))
// {
// CGoGNout << "Vertex of dart "<<d<<CGoGNendl;
// dmV.markOrbit(VERTEX,d);
// }
// if (!dmE.isMarked(d))
// {
// CGoGNout << "Edgee of dart "<<d<<CGoGNendl;
// dmE.markOrbit(EDGE,d);
// }
// if (!dmF.isMarked(d))
// {
// CGoGNout << "Face of dart "<<d<<CGoGNendl;
// dmF.markOrbit(FACE,d);
// }
// }
//
//
// // traverses cells of map with markers on embedded cells.
// // More efficients but more memory costly if cells are not already embedded.
// // Avoid using construction of objects not ell embedded
//
// CGoGNout << "========================="<< CGoGNendl;
// CGoGNout << "Traverse with CellMarkers:"<< CGoGNendl;
// CellMarker cmV(myMap,VERTEX);
// CellMarker cmE(myMap,EDGE);
// CellMarker cmF(myMap,FACE);
// for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
// {
// if (!cmV.isMarked(d))
// {
// CGoGNout << "Vertex of dart "<<d<<CGoGNendl;
// cmV.mark(d);
// }
// if (!cmE.isMarked(d))
// {
// CGoGNout << "Edgee of dart "<<d<<CGoGNendl;
// cmE.mark(d);
// }
// if (!cmF.isMarked(d))
// {
// CGoGNout << "Face of dart "<<d<<CGoGNendl;
// cmF.mark(d);
// }
// }
//
// // markers are cleaned and released at destruction of DartMarkers & CellMarkers
// // DartMarkerStore should be used if few darts are traversed
// // DartMarkerNoUnmark can be use if you want to manage unmarking yourself
} }
...@@ -123,19 +150,46 @@ void MyQT::traverseMap() ...@@ -123,19 +150,46 @@ void MyQT::traverseMap()
void MyQT::createMap() void MyQT::createMap()
{ {
Dart d1 = Algo::Modelisation::Polyhedron<PFP>::createTetra(myMap); // Dart d1 = Algo::Modelisation::Polyhedron<PFP>::createTetra(myMap);
Dart d2 = d1;
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position"); position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
position[d2] = PFP::VEC3(1, 0, 0); Algo::Modelisation::Polyhedron<PFP> prim1(myMap, position);
d2 = PHI1(d2); prim1.cylinder_topo(256,256, true, true); // topo of sphere is a closed cylinder
position[d2] = PFP::VEC3(-1, 0, 0); prim1.embedSphere(2.0f);
d2 = PHI1(d2);
position[d2] = PFP::VEC3(0, 2, 0); // Dart d2 = d1;
d2 = PHI<211>(d2); // position[d2] = PFP::VEC3(1, 0, 0);
position[d2] = PFP::VEC3(0, 1, 2); // d2 = PHI1(d2);
// position[d2] = PFP::VEC3(-1, 0, 0);
// d2 = PHI1(d2);
// position[d2] = PFP::VEC3(0, 2, 0);
// d2 = PHI<211>(d2);
// position[d2] = PFP::VEC3(0, 1, 2);
Algo::Modelisation::Polyhedron<PFP> prim2(myMap, position);
prim2.cylinder_topo(256,256, true, true); // topo of sphere is a closed cylinder
prim2.embedSphere(2.0f);
Geom::Matrix44f trf;
trf.identity();
Geom::translate<float>(5.0f,0.0,0.0,trf);
prim2.transform(trf);
xd1 = prim2.getDart();
// xd1 = Algo::Modelisation::Polyhedron<PFP>::createTetra(myMap);
// Dart xd2 = xd1;
//
// position[xd2] = PFP::VEC3(5, 0, 0);
// xd2 = PHI1(xd2);
// position[xd2] = PFP::VEC3(3, 0, 0);
// xd2 = PHI1(xd2);
// position[xd2] = PFP::VEC3(4, 2, 0);
// xd2 = PHI<211>(xd2);
// position[xd2] = PFP::VEC3(4, 1, 2);
// bounding box of scene // bounding box of scene
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position); Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
......
This diff is collapsed.
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <iostream> #include <iostream>
#define WITH_GMAP 1 //#define WITH_GMAP 1
#include "Topology/generic/parameters.h" #include "Topology/generic/parameters.h"
#ifdef WITH_GMAP #ifdef WITH_GMAP
...@@ -38,24 +38,14 @@ ...@@ -38,24 +38,14 @@
#include "Geometry/vector_gen.h" #include "Geometry/vector_gen.h"
#include "Algo/Geometry/boundingbox.h" #include "Algo/Geometry/boundingbox.h"
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Algo/Render/GL2/topo3Render.h" #include "Algo/Render/GL2/topo3Render.h"
#include "Algo/Render/GL2/explodeVolumeRender.h"
#include "Topology/generic/cellmarker.h"
#include "Utils/text3d.h"
#include "Utils/pointSprite.h"
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/cgognStream.h" #include "Utils/cgognStream.h"
#include "Utils/Qt/qtSimple.h" #include "Utils/Qt/qtSimple.h"
#include "Utils/frameManipulator.h"
#include "ui_tuto5.h" #include "ui_tuto5.h"
// inclure qtui.h juste après le ui_xxx.h
#include "Utils/Qt/qtui.h" #include "Utils/Qt/qtui.h"
...@@ -86,65 +76,62 @@ class MyQT: public Utils::QT::SimpleQT ...@@ -86,65 +76,62 @@ class MyQT: public Utils::QT::SimpleQT
{ {
Q_OBJECT Q_OBJECT
bool render_text; bool render_volumes;
bool render_balls; bool render_edges;
bool render_vectors;
bool render_topo; bool render_topo;
bool render_topoTemp;
bool clip_volume;
bool hide_clipping;
Algo::Render::GL2::Topo3Render* m_topo_render;
Algo::Render::GL2::ExplodeVolumeRender* m_explode_render;
float m_explode_factor;
// for clipping plane manipulation
Utils::Pickable* m_PlanePick;
Utils::FrameManipulator* m_frame;
unsigned int m_pickedAxis;
int m_begX;
int m_begY;
int clip_id1;
int clip_id2;
public:
float m_WidthObj;
Geom::Vec3f m_PosObj;
Algo::Render::GL2::MapRender* m_render;
Algo::Render::GL2::Topo3Render* m_render_topo;
Utils::VBO* m_positionVBO;
Utils::VBO* m_dataVBO;
Utils::ShaderSimpleColor* m_shader;
Utils::ShaderVectorPerVertex* m_lines;
Utils::Strings3D* m_strings;
Utils::PointSprite* m_sprite;
QTimer *m_timer;
public: public:
MyQT(): MyQT():
render_text(true), render_volumes(true),
render_balls(true), render_edges(true),
render_vectors(true),
render_topo(true), render_topo(true),
m_render(NULL), render_topoTemp(true),
m_render_topo(NULL), clip_volume(true),
m_positionVBO(NULL), hide_clipping(false),
m_dataVBO(NULL), m_topo_render(NULL),
m_shader(NULL), m_explode_render(NULL),
m_lines(NULL), m_explode_factor(0.8f)
m_strings(NULL),
m_sprite(NULL),
m_timer(NULL)
{} {}
Dart m_selected;
protected: protected:
void storeVerticesInfo();
void cb_redraw(); void cb_redraw();
void cb_initGL(); void cb_initGL();
void cb_mouseMove(int buttons, int x, int y);
void cb_mousePress(int button, int x, int y);
void cb_mouseRelease(int button, int x, int y);
void cb_mousePress(int button, int x, int y);
void cb_keyPress(int code);
// slots locaux // slots locaux
public slots: public slots:
void balls_onoff(bool x); void volumes_onoff(bool x);
void vectors_onoff(bool x); void edges_onoff(bool x);
void text_onoff(bool x);
void topo_onoff(bool x); void topo_onoff(bool x);
void clipping_onoff(bool x);
void slider_balls(int x); void hide_onoff(bool x);
void slider_vectors(int x); void slider_explode(int x);
void slider_text(int x); void slider_pressed();
void slider_released();
void animate();
}; };
#endif #endif
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>150</width> <width>150</width>
<height>250</height> <height>272</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
...@@ -45,9 +45,9 @@ ...@@ -45,9 +45,9 @@
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QCheckBox" name="checkBox_balls"> <widget class="QCheckBox" name="checkBox_volumes">
<property name="text"> <property name="text">
<string>Balls</string> <string>Volumes</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
...@@ -55,26 +55,19 @@ ...@@ -55,26 +55,19 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QSlider" name="slider_balls"> <widget class="QCheckBox" name="checkBox_edges">
<property name="value"> <property name="text">
<number>50</number> <string>Edges of volumes</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
</widget> <property name="checked">
</item> <bool>true</bool>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkBox_vectors"> <widget class="QCheckBox" name="checkBox_topo">
<property name="text"> <property name="text">
<string>Vectors</string> <string>Topo</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
...@@ -82,7 +75,7 @@ ...@@ -82,7 +75,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QSlider" name="slider_vectors"> <widget class="QSlider" name="slider_explode">
<property name="value"> <property name="value">
<number>50</number> <number>50</number>
</property> </property>
...@@ -92,46 +85,32 @@ ...@@ -92,46 +85,32 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Line" name="line"> <widget class="Line" name="line_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkBox_text"> <widget class="QCheckBox" name="checkBox_plane">
<property name="text"> <property name="text">
<string>Text</string> <string>clipping</string>
</property> </property>
<property name="checked"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> <property name="checked">
</item> <bool>true</bool>
<item>
<widget class="QSlider" name="slider_text">
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Line" name="line_3"> <widget class="QCheckBox" name="checkBox_hide">
<property name="orientation"> <property name="enabled">
<enum>Qt::Horizontal</enum> <bool>true</bool>
</property> </property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_topo">
<property name="text"> <property name="text">
<string>Topo</string> <string>hide clipping plane</string>
</property>
<property name="checked">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -154,54 +133,5 @@ ...@@ -154,54 +133,5 @@
</widget> </widget>
</widget> </widget>
<resources/> <resources/>
<connections> <connections/>
<connection>
<sender>checkBox_balls</sender>
<signal>toggled(bool)</signal>