Commit 2629514a authored by Thomas's avatar Thomas
Browse files

Merge branch 'master' of cgogn.u-strasbg.fr:~cgogn/CGoGN

parents 82fda073 3526329c
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
project(examplesD)
......@@ -54,11 +54,21 @@ add_executable( texturesExampleD ../texturesExample.cpp ${texturesExample_moc} )
target_link_libraries( texturesExampleD
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_CPP(simpleMap3_moc ../simpleMap3.h)
add_executable( simpleMap3D ../simpleMap3.cpp ${simpleMap3_moc} )
target_link_libraries( simpleMap3D
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_CPP(simpleGMap2_moc ../simpleGMap2.h)
add_executable( simpleGMap2D ../simpleGMap2.cpp ${simpleGMap2_moc} )
target_link_libraries( simpleGMap2D
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_CPP(simpleGMap3_moc ../simpleGMap3.h)
add_executable( simpleGMap3D ../simpleGMap3.cpp ${simpleGMap3_moc} )
target_link_libraries( simpleGMap3D
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_CPP(extrusionView_moc ../extrusionView.h)
add_executable( extrusionViewD ../extrusionView.cpp ${extrusionView_moc})
target_link_libraries( extrusionViewD
......
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
project(examples)
......@@ -59,6 +59,11 @@ QT4_WRAP_CPP(simpleGMap2_moc ../simpleGMap2.h)
add_executable( simpleGMap2 ../simpleGMap2.cpp ${simpleGMap2_moc} )
target_link_libraries( simpleGMap2
${CGoGN_LIBS_R} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_CPP(simpleGMap3_moc ../simpleGMap3.h)
add_executable( simpleGMap3 ../simpleGMap3.cpp ${simpleGMap3_moc} )
target_link_libraries( simpleGMap3
${CGoGN_LIBS_R} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_CPP(extrusionView_moc ../extrusionView.h)
add_executable( extrusionView ../extrusionView.cpp ${extrusionView_moc})
......
......@@ -24,8 +24,7 @@
#include <iostream>
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
#include "Topology/map/embeddedMap2.h"
#include <Algo/Geometry/inclusion.h>
#include "Geometry/vector_gen.h"
......@@ -34,7 +33,7 @@ using namespace CGoGN;
struct PFP: public PFP_STANDARD
{
// definition of the type of the map
typedef EmbeddedMap2<Map2> MAP;
typedef EmbeddedMap2 MAP;
};
int main()
......
......@@ -27,8 +27,7 @@
#include <iostream>
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
#include "Topology/map/embeddedMap2.h"
#include "Geometry/vector_gen.h"
#include "Algo/Import/import.h"
......@@ -125,7 +124,7 @@ float Gfont[174*2]={
struct PFP: public PFP_STANDARD
{
// definition of the type of the map
typedef EmbeddedMap2<Map2> MAP;
typedef EmbeddedMap2 MAP;
};
// declaration of the map
......
......@@ -186,10 +186,7 @@ void Clipping::slot_spinBox_GridResolution(int i)
void Clipping::slot_pushButton_changePlanesColor()
{
QColor NewColor;
QColorDialog ColDialog;
NewColor = ColDialog.getColor();
QColor NewColor = QColorDialog::getColor();
int r, g, b;
NewColor.getRgb(&r, &g, &b);
......@@ -229,10 +226,8 @@ void Clipping::slot_spinBox_SphereResolution(int i)
void Clipping::slot_pushButton_changeSpheresColor()
{
QColor NewColor;
QColorDialog ColDialog;
QColor NewColor = QColorDialog::getColor();
NewColor = ColDialog.getColor();
int r, g, b;
NewColor.getRgb(&r, &g, &b);
......
......@@ -35,8 +35,7 @@
#include "Utils/qtui.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map3.h"
#include "Topology/generic/embeddedMap3.h"
#include "Topology/map/embeddedMap3.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
......@@ -66,7 +65,7 @@ using namespace CGoGN ;
struct PFP: public PFP_STANDARD
{
// definition of the map
typedef EmbeddedMap3<Map3> MAP;
typedef EmbeddedMap3 MAP;
};
......
......@@ -27,8 +27,7 @@
#include "extrusionView.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
#include "Topology/map/embeddedMap2.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
......@@ -51,7 +50,7 @@ using namespace CGoGN;
struct PFP: public PFP_STANDARD
{
// definition de la carte
typedef EmbeddedMap2<Map2> MAP;
typedef EmbeddedMap2 MAP;
};
......
......@@ -27,8 +27,7 @@
#include "frame_manip.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
#include "Topology/map/embeddedMap2.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
......@@ -42,7 +41,6 @@
#include "Utils/Shaders/shaderFlat.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/type_precision.hpp"
#include "glm/gtc/type_ptr.hpp"
......@@ -52,7 +50,7 @@ using namespace CGoGN;
struct PFP: public PFP_STANDARD
{
// definition de la carte
typedef EmbeddedMap2<Map2> MAP;
typedef EmbeddedMap2 MAP;
};
PFP::MAP myMap;
......
......@@ -27,8 +27,7 @@
#include "Utils/glutwin_atb.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
#include "Topology/map/embeddedMap2.h"
#include "Geometry/matrix.h"
#include "Geometry/vector_gen.h"
......@@ -51,7 +50,7 @@ using namespace CGoGN ;
struct PFP: public PFP_STANDARD
{
// definition of the map
typedef EmbeddedMap2<Map2> MAP;
typedef EmbeddedMap2 MAP;
};
typedef PFP::MAP MAP;
......
......@@ -27,8 +27,7 @@
#include "polyhedronsView.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
#include "Topology/map/embeddedMap2.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
......@@ -47,7 +46,7 @@ using namespace CGoGN;
struct PFP: public PFP_STANDARD
{
// definition de la carte
typedef EmbeddedMap2<Map2> MAP;
typedef EmbeddedMap2 MAP;
};
PFP::MAP myMap;
......
......@@ -27,8 +27,7 @@
#include "Utils/glutwin.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/generic/embeddedMap2.h"
#include "Topology/map/embeddedMap2.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
......@@ -49,7 +48,7 @@ using namespace CGoGN;
struct PFP: public PFP_STANDARD
{
// definition de la carte
typedef EmbeddedMap2<Map2> MAP;
typedef EmbeddedMap2 MAP;
};
......
......@@ -27,7 +27,6 @@
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/polyhedron.h"
SimpleGMap2::SimpleGMap2()
{
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
......@@ -38,6 +37,10 @@ SimpleGMap2::SimpleGMap2()
position[myMap.phi_1(d)] = VEC3(10,20,15);
position[myMap.phi_1(myMap.phi2(d))] = VEC3(0,0,30);
VEC3 mid = (position[d]+position[myMap.phi1(d)])/2.0f;
myMap.cutEdge(d);
position[myMap.phi1(d)] = mid;
Algo::Modelisation::Polyhedron<PFP> poly(myMap,position);
d = poly.cylinder_topo(5,1,false,false);
......
......@@ -27,8 +27,7 @@
#include "Utils/qtSimple.h"
#include "Topology/generic/parameters.h"
#include "Topology/gmap/gmap2.h"
#include "Topology/generic/embeddedMap2.h"
#include "Topology/gmap/embeddedGMap2.h"
#include "Geometry/vector_gen.h"
......@@ -39,7 +38,7 @@ using namespace CGoGN ;
struct PFP: public PFP_STANDARD
{
// definition of the map
typedef EmbeddedMap2<GMap2> MAP ;
typedef EmbeddedGMap2 MAP ;
};
typedef PFP::MAP MAP ;
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009, 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: https://iggservis.u-strasbg.fr/CGoGN/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "simpleGMap3.h"
#include "Utils/GLSLShader.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Modelisation/subdivision3.h"
SimpleGMap3::SimpleGMap3()
{
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(2,1,1);
primCat.embedHexaGrid(1,1,1);
myMap.check();
DartMarker markOrient(myMap);
std::vector<Dart> orient;
FunctorStore fs(orient);
myMap.foreach_dart_of_oriented_volume(d,fs);
for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it)
markOrient.mark(*it);
SelectorMarked sm(markOrient);
Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap,position,sm);
for(unsigned int i = position.begin() ; i != position.end() ; position.next(i))
position[i] += VEC3(2,0,0);
Algo::Modelisation::Primitive3D<PFP> prim(myMap,position);
d = prim.hexaGrid_topo(2,2,1);
prim.embedHexaGrid(1,1,1);
Dart d1 = myMap.phi1(myMap.phi1(myMap.phi2(myMap.phi1(myMap.phi1(d)))));
VEC3 mid0 = (position[d1]+position[myMap.phi1(d1)])/2.0f;
myMap.cutEdge(d1);
position[myMap.phi1(d1)] = mid0;
VEC3 mid1 = (position[d]+position[myMap.phi1(d)])/2.0f;
myMap.cutEdge(d);
position[myMap.phi1(d)] = mid1;
d = myMap.phi1(myMap.phi1(myMap.phi2(myMap.phi1(myMap.phi1(d)))));
VEC3 mid = (position[d]+position[myMap.phi1(d)])/2.0f;
myMap.cutEdge(d);
position[myMap.phi1(d)] = mid;
for(unsigned int i = position.begin() ; i != position.end() ; position.next(i))
position[i] += VEC3(0,2,0);
Algo::Modelisation::Primitive3D<PFP> prim2(myMap,position);
d = prim2.hexaGrid_topo(2,1,1);
prim2.embedHexaGrid(1,1,1);
d = myMap.phi2(myMap.phi1(myMap.phi1(myMap.phi2(d))));
myMap.unsewVolumes(d);
myMap.check();
}
void SimpleGMap3::initGUI()
{
}
void SimpleGMap3::cb_initGL()
{
Utils::GLSLShader::setCurrentOGLVersion(1) ;
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
VEC3 gPosObj = bb.center() ;
float tailleX = bb.size(0) ;
float tailleY = bb.size(1) ;
float tailleZ = bb.size(2) ;
float gWidthObj = std::max<float>(std::max<float>(tailleX, tailleY), tailleZ) ;
setParamObject(gWidthObj, gPosObj.data());
}
void SimpleGMap3::cb_redraw()
{
glDisable(GL_LIGHTING);
glLineWidth(1.0f);
Algo::Render::GL1::renderTopoGMD3<PFP>(myMap, position, true, true, true, true, 0.9f, 0.9f, 0.9f, 0.9f);
glDisable(GL_LIGHTING);
glColor3f(1.0f, 1.0f, 1.0f);
glLineWidth(1.0f);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
Algo::Render::GL1::renderTriQuadPoly<PFP>(myMap, Algo::Render::GL1::LINE, 1.0,position, normal);
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
int main(int argc, char **argv)
{
QApplication app(argc, argv) ;
SimpleGMap3 sqt ;
sqt.setGeometry(0, 0, 1000, 800) ;
sqt.show() ;
sqt.initGUI() ;
return app.exec() ;
}
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009, 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: https://iggservis.u-strasbg.fr/CGoGN/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include <iostream>
#include "Utils/qtSimple.h"
#include "Topology/generic/parameters.h"
#include "Topology/gmap/embeddedGMap3.h"
#include "Geometry/vector_gen.h"
#include "Algo/Render/GL1/map_glRender.h"
#include "Algo/Render/GL1/topo_render.h"
using namespace CGoGN ;
struct PFP: public PFP_STANDARD
{
// definition of the map
typedef EmbeddedGMap3 MAP ;
};
typedef PFP::MAP MAP ;
typedef PFP::VEC3 VEC3 ;
class SimpleGMap3 : public Utils::QT::SimpleQT
{
Q_OBJECT
public:
MAP myMap ;
SelectorTrue allDarts ;
PFP::TVEC3 position ;
PFP::TVEC3 normal ;
SimpleGMap3() ;
void initGUI() ;
void cb_initGL() ;
void cb_redraw() ;
};
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009, 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: https://iggservis.u-strasbg.fr/CGoGN/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "simpleMap3.h"
#include "Utils/GLSLShader.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Modelisation/subdivision3.h"
SimpleMap3::SimpleMap3()
{
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(2,1,1);
primCat.embedHexaGrid(1,1,1);
unsigned int nb=0;
for(unsigned int i = position.begin(); i!=position.end(); position.next(i))
nb++;
std::cout << "Nb vertices (equals 12) : " << nb << std::endl;
assert(nb==12);
d = myMap.phi2(myMap.phi1(myMap.phi1(myMap.phi2(d))));
Dart dd = myMap.phi3(d);
myMap.unsewVolumes(d);
myMap.check();
nb=0;
for(unsigned int i = position.begin(); i!=position.end(); position.next(i))
nb++;
std::cout << "Nb vertices after unsew (equals 16) : " << nb << std::endl;
assert(nb==16);
myMap.sewVolumes(d,dd);
myMap.check();
nb=0;
for(unsigned int i = position.begin(); i!=position.end(); position.next(i))
nb++;
std::cout << "Nb vertices after resew (equals 12) : " << nb << std::endl;
assert(nb==12);
}
void SimpleMap3::initGUI()
{
}
void SimpleMap3::cb_initGL()
{
Utils::GLSLShader::setCurrentOGLVersion(1) ;
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
VEC3 gPosObj = bb.center() ;
float tailleX = bb.size(0) ;
float tailleY = bb.size(1) ;
float tailleZ = bb.size(2) ;
float gWidthObj = std::max<float>(std::max<float>(tailleX, tailleY), tailleZ) ;
setParamObject(gWidthObj, gPosObj.data());
}
void SimpleMap3::cb_redraw()
{
glDisable(GL_LIGHTING);
glLineWidth(1.0f);
Algo::Render::GL1::renderTopoMD3<PFP>(myMap, position, true, true, true, 0.9f, 0.9f, 0.9f);
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
int main(int argc, char **argv)
{
QApplication app(argc, argv) ;
SimpleMap3 sqt ;
sqt.setGeometry(0, 0, 1000, 800) ;
sqt.show() ;
sqt.initGUI() ;
return app.exec() ;
}
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009, 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: https://iggservis.u-strasbg.fr/CGoGN/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/