Commit 1b8843c3 authored by untereiner's avatar untereiner

Merge cgogn:~thery/CGoGN

parents 4f08fa9d 4797d495
......@@ -103,7 +103,7 @@ void test_compact_map(const std::string& name)
do // mark all edges incident to vertex;
{
dm.markOrbit( EDGE, e);
e = myMap.alpha1(e);
e = myMap.phi2_1(e);
}while (e!=d);
}
i++;
......
......@@ -59,6 +59,11 @@ add_executable( tuto_orbits tuto_orbits.cpp ${tuto_orbits_ui} ${tuto_orbits_moc}
target_link_libraries( tuto_orbits
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( show_traversors_ui show_traversors.ui )
QT4_WRAP_CPP(show_traversors_moc show_traversors.h)
add_executable( show_traversors show_traversors.cpp ${show_traversors_ui} ${show_traversors_moc})
target_link_libraries( show_traversors
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
#add_executable( tuto_subdivision tuto_subdivision.cpp)
#target_link_libraries( tuto_subdivision
......
This diff is collapsed.
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __SHOW_TRAVERSORS_
#define __SHOW_TRAVERSORS_
#include <iostream>
//#define WITH_GMAP 1
#include "Topology/generic/parameters.h"
#ifdef WITH_GMAP
#include "Topology/gmap/embeddedGMap3.h"
#else
#include "Topology/map/embeddedMap3.h"
#endif
#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 "Topology/generic/cellmarker.h"
#include "Utils/text3d.h"
#include "Utils/pointSprite.h"
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/cgognStream.h"
#include "Utils/drawer.h"
#include "Utils/Qt/qtSimple.h"
#include "ui_show_traversors.h"
// inclure qtui.h juste après le ui_xxx.h
#include "Utils/Qt/qtui.h"
using namespace CGoGN ;
struct PFP: public PFP_STANDARD
{
// definition de la carte
#ifdef WITH_GMAP
typedef EmbeddedGMap3 MAP;
#else
typedef EmbeddedMap3 MAP;
#endif
};
using namespace CGoGN ;
/**
* Utilisation de designer-qt4:
* Faire un DockWiget (laisser le nom par defaut
* dans le Contents ajouter le layout choisi (vertical classiquement)
* 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
Algo::Render::GL2::Topo3Render* m_render_topo;
bool m_showTopo;
unsigned int m_val_combo1;
unsigned int m_val_combo2;
unsigned int m_val_combo3;
unsigned int m_val_combo4;
unsigned int m_val_combo5;
unsigned int m_val_combo6;
public:
MyQT():
m_render_topo(NULL),
m_showTopo(true),
m_val_combo1(1),
m_val_combo2(1),
m_val_combo3(2),
m_val_combo4(1),
m_val_combo5(1),
m_val_combo6(2),
m_selected(NIL)
{}
Dart m_selected;
std::vector<Dart> m_affDarts;
Utils::Drawer m_drawer;
protected:
void storeVerticesInfo();
void cb_redraw();
void cb_initGL();
void cb_mousePress(int button, int x, int y);
void colorizeCell(Dart d, unsigned int orbit, float r,float g, float b);
void traverse2();
void traverse3();
// slots locaux
public slots:
void cb_combo1(int x);
void cb_combo2(int x);
void cb_combo3(int x);
void cb_combo4(int x);
void cb_combo5(int x);
void cb_combo6(int x);
void cb_checkTopo(bool b);
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DockWidget</class>
<widget class="QDockWidget" name="DockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>150</width>
<height>417</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>250</height>
</size>
</property>
<property name="windowTitle">
<string>Interface</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>200</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>2</number>
</property>
<property name="spacing">
<number>4</number>
</property>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Traversor2</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo4">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<item>
<property name="text">
<string>Vertex</string>
</property>
</item>
<item>
<property name="text">
<string>Edge</string>
</property>
</item>
<item>
<property name="text">
<string>Face</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo5">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<item>
<property name="text">
<string>incident to</string>
</property>
</item>
<item>
<property name="text">
<string>adjacent by</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo6">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Vertex</string>
</property>
</item>
<item>
<property name="text">
<string>Edge</string>
</property>
</item>
<item>
<property name="text">
<string>Face</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Traversor3</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo1">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<item>
<property name="text">
<string>Vertex</string>
</property>
</item>
<item>
<property name="text">
<string>Edge</string>
</property>
</item>
<item>
<property name="text">
<string>Face</string>
</property>
</item>
<item>
<property name="text">
<string>Volume</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo2">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<item>
<property name="text">
<string>incident to</string>
</property>
</item>
<item>
<property name="text">
<string>adjacent by</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="combo3">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Vertex</string>
</property>
</item>
<item>
<property name="text">
<string>Edge</string>
</property>
</item>
<item>
<property name="text">
<string>Face</string>
</property>
</item>
<item>
<property name="text">
<string>Volume</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkTopo">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>show topo</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
......@@ -61,6 +61,7 @@ void MyQT::orbit_list(int x)
{
storeVerticesInfo<int>(m_att_orbits[x]);
current_orbit = x;
m_selected.clear();
updateGL();
}
......@@ -234,7 +235,7 @@ int main(int argc, char **argv)
sqt.setDock(&dock);
// message d'aide
sqt.setHelpMsg("Enter pour dock on/off\nShift Enter pour console on/off\nShift Click gauche pour selectionner un brin");
sqt.setHelpMsg("Select an orbit then\nshift click left to select a dart");
sqt.initMap();
......
......@@ -38,17 +38,17 @@ void mergeVertex(typename PFP::MAP& map, const typename PFP::TVEC3& positions, D
Dart dd;
do
{
dd = map.alpha1(d);
dd = map.phi2_1(d);
map.removeEdgeFromVertex(dd);
Dart ee = e;
do
{
if(Geom::testOrientation2D(positions[map.phi1(dd)],positions[ee],positions[map.phi1(ee)])!=Geom::RIGHT
&& Geom::testOrientation2D(positions[map.phi1(dd)],positions[ee],positions[map.phi1(map.alpha1(ee))])==Geom::RIGHT)
&& Geom::testOrientation2D(positions[map.phi1(dd)],positions[ee],positions[map.phi1(map.phi2_1(ee))])==Geom::RIGHT)
{
break;
}
ee = map.alpha1(ee);
ee = map.phi2_1(ee);
} while(ee != e);
map.insertEdgeInVertex(ee,dd);
} while(dd!=d);
......
......@@ -56,18 +56,18 @@ bool edgeCanCollapse(typename PFP::MAP& map, Dart d, AttributeHandler<unsigned i
unsigned int vu1[32]; // pas de vector mais un tableau (find a la main, mais pas d'allocation par reserve)
val_vd -= 3; // evite le -3 dans la boucle
val_vdd -= 3;
Dart vit1 = map.alpha1(map.alpha1(d));
Dart vit1 = map.phi2_1(map.phi2_1(d));
for (unsigned int i = 0; i< val_vd; ++i)
{
unsigned int ve = map.getEmbedding(map.phi2(vit1),VERTEX);
vu1[i] = ve;
vit1 = map.alpha1(vit1);
vit1 = map.phi2_1(vit1);
}
val_vd--; // pour le parcours avec while >=0
Dart vit2 = map.alpha1(map.alpha1(dd));
Dart vit2 = map.phi2_1(map.phi2_1(dd));
for (unsigned int i = 0; i< val_vdd; ++i)
{
unsigned int ve = map.getEmbedding(map.phi2(vit2),VERTEX);
......@@ -79,7 +79,7 @@ bool edgeCanCollapse(typename PFP::MAP& map, Dart d, AttributeHandler<unsigned i
return false;
--j;
}
vit2 = map.alpha1(vit2);
vit2 = map.phi2_1(vit2);
}
return true;
......@@ -96,16 +96,16 @@ bool edgeCanCollapse(typename PFP::MAP& map, Dart d)
int val_vd = 0 ;
Dart tmp = d ;
do { ++val_vd ; tmp = map.alpha1(tmp) ; } while(tmp != d) ;
do { ++val_vd ; tmp = map.phi2_1(tmp) ; } while(tmp != d) ;
int val_vdd = 0 ;
tmp = dd ;
do { ++val_vdd ; tmp = map.alpha1(tmp) ; } while(tmp != dd) ;
do { ++val_vdd ; tmp = map.phi2_1(tmp) ; } while(tmp != dd) ;
int val_vdp = 0 ;
tmp = dp ;
do { ++val_vdp ; tmp = map.alpha1(tmp) ; } while(tmp != dp) ;
do { ++val_vdp ; tmp = map.phi2_1(tmp) ; } while(tmp != dp) ;
int val_vddp = 0 ;
tmp = ddp ;
do { ++val_vddp ; tmp = map.alpha1(tmp) ; } while(tmp != ddp) ;
do { ++val_vddp ; tmp = map.phi2_1(tmp) ; } while(tmp != ddp) ;
if(val_vd + val_vdd < 8 || val_vd + val_vdd > 11 || val_vdp < 5 || val_vddp < 5)
return false;
......@@ -115,18 +115,18 @@ bool edgeCanCollapse(typename PFP::MAP& map, Dart d)
unsigned int vu1[32]; // pas de vector mais un tableau (find a la main, mais pas d'allocation par reserve)
val_vd -= 3; // evite le -3 dans la boucle
val_vdd -= 3;
Dart vit1 = map.alpha1(map.alpha1(d));
Dart vit1 = map.phi2_1(map.phi2_1(d));
for (int i = 0; i < val_vd; ++i)
{
unsigned int ve = map.getEmbedding(map.phi2(vit1),VERTEX);
vu1[i] = ve;
vit1 = map.alpha1(vit1);
vit1 = map.phi2_1(vit1);
}
val_vd--; // pour le parcours avec while >=0
Dart vit2 = map.alpha1(map.alpha1(dd));
Dart vit2 = map.phi2_1(map.phi2_1(dd));
for (int i = 0; i < val_vdd; ++i)
{
unsigned int ve = map.getEmbedding(map.phi2(vit2),VERTEX);
......@@ -138,7 +138,7 @@ bool edgeCanCollapse(typename PFP::MAP& map, Dart d)
return false;
--j;
}
vit2 = map.alpha1(vit2);
vit2 = map.phi2_1(vit2);
}
return true;
......
......@@ -204,19 +204,19 @@ void EdgeSelector_Length<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{
initEdgeInfo(vit) ; // various optimizations are applied here by
// treating differently :
Dart vit2 = m.alpha_1(m.phi1(vit)) ; // - edges for which the criteria must be recomputed
Dart vit2 = m.phi12(m.phi1(vit)) ; // - edges for which the criteria must be recomputed
Dart stop = m.phi2(vit) ; // - edges that must be re-embedded
do // - edges for which only the collapsibility must be re-tested
{
updateEdgeInfo(vit2, false) ;
updateEdgeInfo(m.phi1(vit2), false) ;
vit2 = m.alpha_1(vit2) ;
vit2 = m.phi12(vit2) ;
} while(vit2 != stop) ;
}
else
updateEdgeInfo(vit, true) ;
vit = m.alpha1(vit) ;
vit = m.phi2_1(vit) ;
} while(vit != d2) ;
cur = edges.begin() ; // set the current edge to the first one
......@@ -399,19 +399,19 @@ void EdgeSelector_QEM<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{
initEdgeInfo(vit) ; // various optimizations are applied here by
// treating differently :
Dart vit2 = m.alpha_1(m.phi1(vit)) ; // - edges for which the criteria must be recomputed
Dart vit2 = m.phi12(m.phi1(vit)) ; // - edges for which the criteria must be recomputed
Dart stop = m.phi2(vit) ; // - edges that must be re-embedded
do // - edges for which only the collapsibility must be re-tested
{
updateEdgeInfo(vit2, false) ;
updateEdgeInfo(m.phi1(vit2), false) ;
vit2 = m.alpha_1(vit2) ;
vit2 = m.phi12(vit2) ;
} while(vit2 != stop) ;
}
else
updateEdgeInfo(vit, true) ;
vit = m.alpha1(vit) ;
vit = m.phi2_1(vit) ;
} while(vit != d2) ;
cur = edges.begin() ; // set the current edge to the first one
......@@ -604,7 +604,7 @@ void EdgeSelector_QEMml<PFP>::recomputeQuadric(const Dart d, const bool recomput
do {
// Make step
dBack = this->m_map.phi2(dFront) ;
dFront = this->m_map.alpha1(dFront) ;
dFront = this->m_map.phi2_1(dFront) ;
if (dBack != dFront) { // if dFront is no border
quadric[d] += Quadric<REAL>(this->m_position[d],this->m_position[this->m_map.phi2(dFront)],this->m_position[dBack]) ;
......@@ -633,16 +633,16 @@ void EdgeSelector_QEMml<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
else // treating differently :
updateEdgeInfo(vit, true) ;
Dart vit2 = m.alpha_1(m.phi1(vit)) ; // - edges for which the criteria must be recomputed
Dart vit2 = m.phi12(m.phi1(vit)) ; // - edges for which the criteria must be recomputed
Dart stop = m.phi2(vit) ; // - edges that must be re-embedded
do // - edges for which only the collapsibility must be re-tested
{
updateEdgeInfo(vit2, true) ;
updateEdgeInfo(m.phi1(vit2), false) ;
vit2 = m.alpha_1(vit2) ;
vit2 = m.phi12(vit2) ;
} while(vit2 != stop) ;
vit = m.alpha1(vit) ;
vit = m.phi2_1(vit) ;
} while(vit != d2) ;
cur = edges.begin() ; // set the current edge to the first one
......@@ -809,19 +809,19 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{
initEdgeInfo(vit) ; // various optimizations are applied here by
// treating differently :
Dart vit2 = m.alpha_1(m.phi1(vit)) ; // - edges for which the criteria must be recomputed
Dart vit2 = m.phi12(m.phi1(vit)) ; // - edges for which the criteria must be recomputed
Dart stop = m.phi2(vit) ; // - edges that must be re-embedded
do // - edges for which only the collapsibility must be re-tested
{
updateEdgeInfo(vit2, false) ;
updateEdgeInfo(m.phi1(vit2), false) ;
vit2 = m.alpha_1(vit2) ;
vit2 = m.phi12(vit2) ;
} while(vit2 != stop) ;
}
else