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 )
add_executable( clippingD ../clipping.cpp ${clipping_ui} ${clipping_moc})
target_link_libraries( clippingD
${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 )
add_executable( clipping ../clipping.cpp ${clipping_ui} ${clipping_moc})
target_link_libraries( clipping
${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()
Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(3,1,1);
primCat.embedHexaGrid(2,1,1);
std::cout << "AAA"<< std::endl;
myMap.check();
std::cout << "AAA"<< std::endl;
DartMarker markOrient(myMap);
std::vector<Dart> orient;
FunctorStore fs(orient);
......@@ -47,11 +47,13 @@ SimpleGMap3::SimpleGMap3()
d = 49;
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)
markOrient.mark(*it);
SelectorMarked sm(markOrient);
std::cout << "AAA"<< std::endl;
Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap, position, sm);
for(unsigned int i = position.begin() ; i != position.end() ; position.next(i))
......@@ -86,6 +88,7 @@ SimpleGMap3::SimpleGMap3()
myMap.unsewVolumes(d);
myMap.check();
}
void SimpleGMap3::initGUI()
......
......@@ -53,6 +53,12 @@ add_executable( tuto5 tuto5.cpp ${tuto5_ui} ${tuto5_moc})
target_link_libraries( tuto5
${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)
#target_link_libraries( tuto_subdivision
......
......@@ -55,67 +55,94 @@ int main(int argc, char **argv)
return app.exec();
}
Dart xd1;
void MyQT::traverseMap()
{
DartMarker m1(myMap);
DartMarker m2(myMap);
myMap.rdfi(myMap.begin(),m1,m2);
//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);
}
}
m1.unmarkAll();
m1.markOrbit(VOLUME,xd1);
// 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
// render the topo of the map without boundary darts
SelectorDartNoBoundary<PFP::MAP> nb(myMap);
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))
{
if (!cmV.isMarked(d))
{
CGoGNout << "Vertex of dart "<<d<<CGoGNendl;
cmV.mark(d);
}
if (!cmE.isMarked(d))
if (m2.isMarked(d))
{
CGoGNout << "Edgee of dart "<<d<<CGoGNendl;
cmE.mark(d);
m_render_topo->setDartColor(d,1.0f,0.0f,0.0f);
}
if (!cmF.isMarked(d))
if (m1.isMarked(d))
{
CGoGNout << "Face of dart "<<d<<CGoGNendl;
cmF.mark(d);
m_render_topo->setDartColor(d,0.0f,1.0f,0.0f);
}
}
// 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()
void MyQT::createMap()
{
Dart d1 = Algo::Modelisation::Polyhedron<PFP>::createTetra(myMap);
Dart d2 = d1;
// Dart d1 = Algo::Modelisation::Polyhedron<PFP>::createTetra(myMap);
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
position[d2] = PFP::VEC3(1, 0, 0);
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> prim1(myMap, position);
prim1.cylinder_topo(256,256, true, true); // topo of sphere is a closed cylinder
prim1.embedSphere(2.0f);
// Dart d2 = d1;
// position[d2] = PFP::VEC3(1, 0, 0);
// 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
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
......
This diff is collapsed.
......@@ -27,7 +27,7 @@
#include <iostream>
#define WITH_GMAP 1
//#define WITH_GMAP 1
#include "Topology/generic/parameters.h"
#ifdef WITH_GMAP
......@@ -38,24 +38,14 @@
#include "Geometry/vector_gen.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/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/Qt/qtSimple.h"
#include "Utils/frameManipulator.h"
#include "ui_tuto5.h"
// inclure qtui.h juste après le ui_xxx.h
#include "Utils/Qt/qtui.h"
......@@ -86,65 +76,62 @@ class MyQT: public Utils::QT::SimpleQT
{
Q_OBJECT
bool render_text;
bool render_balls;
bool render_vectors;
bool render_volumes;
bool render_edges;
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:
MyQT():
render_text(true),
render_balls(true),
render_vectors(true),
render_volumes(true),
render_edges(true),
render_topo(true),
m_render(NULL),
m_render_topo(NULL),
m_positionVBO(NULL),
m_dataVBO(NULL),
m_shader(NULL),
m_lines(NULL),
m_strings(NULL),
m_sprite(NULL),
m_timer(NULL)
render_topoTemp(true),
clip_volume(true),
hide_clipping(false),
m_topo_render(NULL),
m_explode_render(NULL),
m_explode_factor(0.8f)
{}
Dart m_selected;
protected:
void storeVerticesInfo();
void cb_redraw();
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
public slots:
void balls_onoff(bool x);
void vectors_onoff(bool x);
void text_onoff(bool x);
void volumes_onoff(bool x);
void edges_onoff(bool x);
void topo_onoff(bool x);
void slider_balls(int x);
void slider_vectors(int x);
void slider_text(int x);
void animate();
void clipping_onoff(bool x);
void hide_onoff(bool x);
void slider_explode(int x);
void slider_pressed();
void slider_released();
};
#endif
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>150</width>
<height>250</height>
<height>272</height>
</rect>
</property>
<property name="minimumSize">
......@@ -45,9 +45,9 @@
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBox_balls">
<widget class="QCheckBox" name="checkBox_volumes">
<property name="text">
<string>Balls</string>
<string>Volumes</string>
</property>
<property name="checked">
<bool>true</bool>
......@@ -55,26 +55,19 @@
</widget>
</item>
<item>
<widget class="QSlider" name="slider_balls">
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QCheckBox" name="checkBox_edges">
<property name="text">
<string>Edges of volumes</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_vectors">
<widget class="QCheckBox" name="checkBox_topo">
<property name="text">
<string>Vectors</string>
<string>Topo</string>
</property>
<property name="checked">
<bool>true</bool>
......@@ -82,7 +75,7 @@
</widget>
</item>
<item>
<widget class="QSlider" name="slider_vectors">
<widget class="QSlider" name="slider_explode">
<property name="value">
<number>50</number>
</property>
......@@ -92,46 +85,32 @@
</widget>
</item>
<item>
<widget class="Line" name="line">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_text">
<widget class="QCheckBox" name="checkBox_plane">
<property name="text">
<string>Text</string>
<string>clipping</string>
</property>
<property name="checked">
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="slider_text">
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QCheckBox" name="checkBox_hide">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_topo">
<property name="text">
<string>Topo</string>
</property>
<property name="checked">
<bool>true</bool>
<string>hide clipping plane</string>
</property>
</widget>
</item>
......@@ -154,54 +133,5 @@
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>checkBox_balls</sender>
<signal>toggled(bool)</signal>
<receiver>slider_balls</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>95</x>
<y>37</y>
</hint>
<hint type="destinationlabel">
<x>95</x>
<y>63</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkBox_text</sender>
<signal>toggled(bool)</signal>
<receiver>slider_text</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>95</x>
<y>157</y>
</hint>
<hint type="destinationlabel">
<x>95</x>
<y>183</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkBox_vectors</sender>
<signal>toggled(bool)</signal>
<receiver>slider_vectors</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>95</x>
<y>97</y>
</hint>
<hint type="destinationlabel">
<x>95</x>
<y>123</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>
......@@ -233,9 +233,12 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Func
{
center += attributs[it];
++count ;
me.unmarkOrbitInParent<typename PFP::MAP>(EDGE, it);
// me.unmarkOrbitInParent<typename PFP::MAP>(EDGE, it);
me.unmarkOrbit(PFP::MAP::ORBIT_IN_PARENT(EDGE), it);
it = map.phi1(it) ;
me.unmarkOrbitInParent<typename PFP::MAP>(EDGE, it);
// me.unmarkOrbitInParent<typename PFP::MAP>(EDGE, it);
me.unmarkOrbit(PFP::MAP::ORBIT_IN_PARENT(EDGE), it);
it = map.phi1(it) ;
} while(it != d) ;
center /= double(count);
......
......@@ -112,7 +112,8 @@ void catmullClarkVol(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
if(selected(d) && !mv.isMarked(d))
{
l_vertices.push_back(d);
mv.markOrbitInParent<typename PFP::MAP>(VERTEX,d);
// mv.markOrbitInParent<typename PFP::MAP>(VERTEX,d);
mv.markOrbit(PFP::MAP::ORBIT_IN_PARENT(VERTEX),d);
}
//cut edges
......
......@@ -86,6 +86,11 @@ GenericMap::GenericMap() : m_nbThreads(1)
// get & lock marker for boundary
m_boundaryMarker = m_marksets[DART][0].getNewMark();
#ifndef CGoGN_FORCE_MR
m_isMultiRes = false;
#endif
}
GenericMap::~GenericMap()
......@@ -547,13 +552,23 @@ bool GenericMap::foreach_dart_of_orbit(unsigned int orbit, Dart d, FunctorType&
{
switch(orbit)
{
case DART: return f(d);
case VERTEX: return foreach_dart_of_vertex(d, f, thread);
case EDGE: return foreach_dart_of_edge(d, f, thread);
case ORIENTED_FACE: return foreach_dart_of_oriented_face(d, f, thread);
case FACE: return foreach_dart_of_face(d, f, thread);
case VOLUME: return foreach_dart_of_volume(d, f, thread);
// case -1: return foreach_dart_of_cc(d,f,thread);
// case DART: return f(d);
// case VERTEX: return foreach_dart_of_vertex(d, f, thread);
// case EDGE: return foreach_dart_of_edge(d, f, thread);
// case ORIENTED_FACE: return foreach_dart_of_oriented_face(d, f, thread);
// case FACE: return foreach_dart_of_face(d, f, thread);
// case VOLUME: return foreach_dart_of_volume(d, f, thread);
case DART: return f(d);
case VERTEX: return foreach_dart_of_vertex(d, f, thread);
case EDGE: return foreach_dart_of_edge(d, f, thread);
case FACE: return foreach_dart_of_face(d, f, thread);
case VOLUME: return foreach_dart_of_volume(d, f, thread);
case VERTEX1: return foreach_dart_of_vertex1(d, f, thread);
case EDGE1: return foreach_dart_of_edge1(d, f, thread);
case VERTEX2: return foreach_dart_of_vertex2(d, f, thread);
case EDGE2: return foreach_dart_of_edge2(d, f, thread);