Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hurstel
CGoGN
Commits
cb0ca9b0
Commit
cb0ca9b0
authored
Jun 20, 2012
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Plain Diff
Merge cgogn:~cgogn/CGoGN
parents
d8a25512
c6088ade
Changes
117
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
117 changed files
with
6415 additions
and
2076 deletions
+6415
-2076
Apps/Examples/simpleGMap3.cpp
Apps/Examples/simpleGMap3.cpp
+27
-18
Apps/Examples/simpleGMap3.h
Apps/Examples/simpleGMap3.h
+2
-0
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+23
-4
Apps/Examples/viewer.h
Apps/Examples/viewer.h
+4
-1
Apps/Examples/volumeExplorer.cpp
Apps/Examples/volumeExplorer.cpp
+12
-0
Apps/Examples/volumeExplorer.h
Apps/Examples/volumeExplorer.h
+1
-1
Apps/Tuto/CMakeLists.txt
Apps/Tuto/CMakeLists.txt
+7
-1
Apps/Tuto/tuto_histo.cpp
Apps/Tuto/tuto_histo.cpp
+324
-0
Apps/Tuto/tuto_histo.h
Apps/Tuto/tuto_histo.h
+142
-0
Apps/Tuto/tuto_oper2.cpp
Apps/Tuto/tuto_oper2.cpp
+5
-3
Apps/Tuto/tuto_oper3.cpp
Apps/Tuto/tuto_oper3.cpp
+174
-2
Apps/Tuto/tuto_oper3.h
Apps/Tuto/tuto_oper3.h
+21
-2
Apps/Tuto/tuto_oper3.ui
Apps/Tuto/tuto_oper3.ui
+116
-98
Apps/deprecated/polyhedronsView.cpp
Apps/deprecated/polyhedronsView.cpp
+4
-4
Debug/CMakeLists.txt
Debug/CMakeLists.txt
+5
-2
README.TXT
README.TXT
+1
-1
Release/CMakeLists.txt
Release/CMakeLists.txt
+6
-3
apps_cmake.txt
apps_cmake.txt
+6
-0
include/Algo/Decimation/simplifMesh.h
include/Algo/Decimation/simplifMesh.h
+7
-7
include/Algo/DecimationVolumes/approximator.h
include/Algo/DecimationVolumes/approximator.h
+119
-0
include/Algo/DecimationVolumes/decimator.h
include/Algo/DecimationVolumes/decimator.h
+60
-0
include/Algo/DecimationVolumes/decimator.hpp
include/Algo/DecimationVolumes/decimator.hpp
+128
-0
include/Algo/DecimationVolumes/edgeSelector.h
include/Algo/DecimationVolumes/edgeSelector.h
+182
-0
include/Algo/DecimationVolumes/edgeSelector.hpp
include/Algo/DecimationVolumes/edgeSelector.hpp
+214
-0
include/Algo/DecimationVolumes/geometryApproximator.h
include/Algo/DecimationVolumes/geometryApproximator.h
+68
-0
include/Algo/DecimationVolumes/geometryApproximator.hpp
include/Algo/DecimationVolumes/geometryApproximator.hpp
+89
-0
include/Algo/DecimationVolumes/operator.h
include/Algo/DecimationVolumes/operator.h
+141
-0
include/Algo/DecimationVolumes/operator.hpp
include/Algo/DecimationVolumes/operator.hpp
+136
-0
include/Algo/DecimationVolumes/selector.h
include/Algo/DecimationVolumes/selector.h
+120
-0
include/Algo/DecimationVolumique/approximator.h
include/Algo/DecimationVolumique/approximator.h
+0
-77
include/Algo/DecimationVolumique/approximator.hpp
include/Algo/DecimationVolumique/approximator.hpp
+0
-63
include/Algo/DecimationVolumique/decimator.h
include/Algo/DecimationVolumique/decimator.h
+0
-37
include/Algo/DecimationVolumique/decimator.hpp
include/Algo/DecimationVolumique/decimator.hpp
+0
-111
include/Algo/DecimationVolumique/operator.h
include/Algo/DecimationVolumique/operator.h
+0
-114
include/Algo/DecimationVolumique/selector.h
include/Algo/DecimationVolumique/selector.h
+0
-298
include/Algo/DecimationVolumique/selector.hpp
include/Algo/DecimationVolumique/selector.hpp
+0
-223
include/Algo/Export/export.h
include/Algo/Export/export.h
+22
-2
include/Algo/Export/export.hpp
include/Algo/Export/export.hpp
+106
-3
include/Algo/Export/exportPov.h
include/Algo/Export/exportPov.h
+20
-47
include/Algo/Geometry/normal.hpp
include/Algo/Geometry/normal.hpp
+2
-2
include/Algo/Geometry/normalization.h
include/Algo/Geometry/normalization.h
+2
-2
include/Algo/Geometry/stats.h
include/Algo/Geometry/stats.h
+1
-1
include/Algo/Geometry/volume.hpp
include/Algo/Geometry/volume.hpp
+1
-1
include/Algo/Histogram/histogram.h
include/Algo/Histogram/histogram.h
+362
-0
include/Algo/Histogram/histogram.hpp
include/Algo/Histogram/histogram.hpp
+285
-0
include/Algo/ImplicitHierarchicalMesh/subdivision3.h
include/Algo/ImplicitHierarchicalMesh/subdivision3.h
+11
-11
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
include/Algo/ImplicitHierarchicalMesh/subdivision3.hpp
+12
-12
include/Algo/Import/import.h
include/Algo/Import/import.h
+20
-12
include/Algo/Import/import2tables.h
include/Algo/Import/import2tables.h
+4
-5
include/Algo/Import/import2tablesSurface.hpp
include/Algo/Import/import2tablesSurface.hpp
+396
-301
include/Algo/Import/import2tablesVolume.hpp
include/Algo/Import/import2tablesVolume.hpp
+9
-1
include/Algo/Import/importChoupi.hpp
include/Algo/Import/importChoupi.hpp
+131
-0
include/Algo/Import/importMesh.hpp
include/Algo/Import/importMesh.hpp
+110
-2
include/Algo/Import/importMoka.hpp
include/Algo/Import/importMoka.hpp
+1
-1
include/Algo/Import/importPlyData.h
include/Algo/Import/importPlyData.h
+2
-0
include/Algo/Import/importTet.hpp
include/Algo/Import/importTet.hpp
+4
-5
include/Algo/MC/marchingcubeGen.h
include/Algo/MC/marchingcubeGen.h
+1
-1
include/Algo/Modelisation/polyhedron.h
include/Algo/Modelisation/polyhedron.h
+3
-4
include/Algo/Modelisation/polyhedron.hpp
include/Algo/Modelisation/polyhedron.hpp
+1
-1
include/Algo/Modelisation/primitives3d.h
include/Algo/Modelisation/primitives3d.h
+0
-2
include/Algo/Modelisation/primitives3d.hpp
include/Algo/Modelisation/primitives3d.hpp
+4
-34
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+1
-1
include/Algo/Modelisation/subdivision3.h
include/Algo/Modelisation/subdivision3.h
+32
-0
include/Algo/Modelisation/subdivision3.hpp
include/Algo/Modelisation/subdivision3.hpp
+351
-189
include/Algo/Modelisation/tetrahedralization.h
include/Algo/Modelisation/tetrahedralization.h
+25
-4
include/Algo/Modelisation/tetrahedralization.hpp
include/Algo/Modelisation/tetrahedralization.hpp
+103
-15
include/Algo/Modelisation/triangulation.hpp
include/Algo/Modelisation/triangulation.hpp
+0
-1
include/Algo/Multiresolution/map2MR/map2MR_PM.h
include/Algo/Multiresolution/map2MR/map2MR_PM.h
+48
-24
include/Algo/Multiresolution/map2MR/map2MR_PM.hpp
include/Algo/Multiresolution/map2MR/map2MR_PM.hpp
+211
-0
include/Algo/Render/GL2/colorPerFaceRender.h
include/Algo/Render/GL2/colorPerFaceRender.h
+6
-4
include/Algo/Render/GL2/colorPerFaceRender.hpp
include/Algo/Render/GL2/colorPerFaceRender.hpp
+6
-4
include/Algo/Render/GL2/mapRender.hpp
include/Algo/Render/GL2/mapRender.hpp
+2
-2
include/Algo/Render/GL2/topo3Render.hpp
include/Algo/Render/GL2/topo3Render.hpp
+1
-2
include/Algo/Render/GL2/topoRender.hpp
include/Algo/Render/GL2/topoRender.hpp
+2
-2
include/Algo/Render/SVG/mapSVGRender.h
include/Algo/Render/SVG/mapSVGRender.h
+2
-2
include/Algo/Render/SVG/mapSVGRender.hpp
include/Algo/Render/SVG/mapSVGRender.hpp
+2
-2
include/Geometry/intersection.h
include/Geometry/intersection.h
+14
-3
include/Geometry/intersection.hpp
include/Geometry/intersection.hpp
+16
-8
include/Topology/generic/attributeHandler.h
include/Topology/generic/attributeHandler.h
+5
-0
include/Topology/generic/attributeHandler.hpp
include/Topology/generic/attributeHandler.hpp
+8
-0
include/Topology/generic/functor.h
include/Topology/generic/functor.h
+0
-1
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+10
-0
include/Topology/generic/traversor3.h
include/Topology/generic/traversor3.h
+0
-1
include/Topology/generic/traversor3.hpp
include/Topology/generic/traversor3.hpp
+1
-1
include/Topology/gmap/gmap1.h
include/Topology/gmap/gmap1.h
+10
-10
include/Topology/gmap/gmap1.hpp
include/Topology/gmap/gmap1.hpp
+11
-11
include/Topology/gmap/gmap2.h
include/Topology/gmap/gmap2.h
+17
-10
include/Topology/gmap/gmap2.hpp
include/Topology/gmap/gmap2.hpp
+3
-3
include/Topology/gmap/gmap3.h
include/Topology/gmap/gmap3.h
+31
-7
include/Topology/map/embeddedMap3.h
include/Topology/map/embeddedMap3.h
+11
-0
include/Topology/map/map2MR/filters_Primal.h
include/Topology/map/map2MR/filters_Primal.h
+32
-30
include/Topology/map/map3.h
include/Topology/map/map3.h
+17
-1
include/Utils/Qt/qtSimple.h
include/Utils/Qt/qtSimple.h
+3
-2
include/Utils/Qt/qtcolorschooser.h
include/Utils/Qt/qtcolorschooser.h
+102
-0
include/Utils/Qt/qtgl.h
include/Utils/Qt/qtgl.h
+0
-2
include/Utils/Qt/qthistodraw.h
include/Utils/Qt/qthistodraw.h
+177
-0
include/Utils/Qt/qtpopup.h
include/Utils/Qt/qtpopup.h
+87
-0
include/Utils/colorMaps.h
include/Utils/colorMaps.h
+80
-140
include/Utils/colorMaps.hpp
include/Utils/colorMaps.hpp
+153
-0
src/Algo/Histogram/histogram.cpp
src/Algo/Histogram/histogram.cpp
+211
-0
src/Algo/Import/importPlyData.cpp
src/Algo/Import/importPlyData.cpp
+4
-0
src/Algo/Import/ply.c
src/Algo/Import/ply.c
+87
-39
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+2
-2
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+36
-1
src/Topology/gmap/embeddedGMap3.cpp
src/Topology/gmap/embeddedGMap3.cpp
+12
-3
src/Topology/gmap/gmap1.cpp
src/Topology/gmap/gmap1.cpp
+7
-3
src/Topology/gmap/gmap2.cpp
src/Topology/gmap/gmap2.cpp
+29
-15
src/Topology/gmap/gmap3.cpp
src/Topology/gmap/gmap3.cpp
+33
-4
src/Topology/map/embeddedMap3.cpp
src/Topology/map/embeddedMap3.cpp
+52
-0
src/Topology/map/map2.cpp
src/Topology/map/map2.cpp
+1
-1
src/Topology/map/map3.cpp
src/Topology/map/map3.cpp
+132
-0
src/Utils/Qt/qtSimple.cpp
src/Utils/Qt/qtSimple.cpp
+4
-1
src/Utils/Qt/qtcolorschooser.cpp
src/Utils/Qt/qtcolorschooser.cpp
+84
-0
src/Utils/Qt/qtgl.cpp
src/Utils/Qt/qtgl.cpp
+0
-5
src/Utils/Qt/qthistodraw.cpp
src/Utils/Qt/qthistodraw.cpp
+396
-0
src/Utils/Qt/qtinputs.cpp
src/Utils/Qt/qtinputs.cpp
+0
-0
src/Utils/Qt/qtpopup.cpp
src/Utils/Qt/qtpopup.cpp
+91
-0
No files found.
Apps/Examples/simpleGMap3.cpp
View file @
cb0ca9b0
...
...
@@ -34,27 +34,31 @@ SimpleGMap3::SimpleGMap3()
normal
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"normal"
);
volume
=
myMap
.
addAttribute
<
VEC3
,
VOLUME
>
(
"volume"
);
CellMarker
<
EDGE
>
mE
(
myMap
);
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
);
// DartMarker markOrient(myMap);
// std::vector<Dart> orient;
// FunctorStore fs(orient);
d
=
49
;
myMap
.
foreach_dart_of_oriented_volume
(
d
,
fs
);
// d = 49;
// myMap.foreach_dart_of_oriented_volume(d, fs);
// for(std::vector<Dart>::iterator it = orient.begin() ; it != orient.end() ; ++it)
// markOrient.mark(*it);
std
::
cout
<<
"AAA"
<<
std
::
endl
;
// SelectorMarked sm(markOrient);
// std::cout << "AAA"<< std::endl;
// Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap, position, sm);
for
(
std
::
vector
<
Dart
>::
iterator
it
=
orient
.
begin
()
;
it
!=
orient
.
end
()
;
++
it
)
markOrient
.
mark
(
*
it
);
// Geom::Plane3D<PFP::REAL> pl(VEC3(0.5,0.14,0.5),VEC3(1.5,0.45,0.5),VEC3(0.5,0.15,1.5));
Geom
::
Plane3D
<
PFP
::
REAL
>
pl
(
VEC3
(
-
1
,
-
0.5
,
-
0.5
),
VEC3
(
-
1
,
-
0.5
,
0.5
),
VEC3
(
1
,
0.5
,
0.5
));
Algo
::
Modelisation
::
sliceConvexVolume
<
PFP
>
(
myMap
,
position
,
d
,
pl
);
SelectorMarked
sm
(
markOrient
);
std
::
cout
<<
"AAA"
<<
std
::
endl
;
//Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap, position, sm);
myMap
.
check
();
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
position
[
i
]
+=
VEC3
(
2
,
0
,
0
);
...
...
@@ -77,6 +81,10 @@ SimpleGMap3::SimpleGMap3()
myMap
.
cutEdge
(
d
);
position
[
myMap
.
phi1
(
d
)]
=
mid
;
myMap
.
splitFace
(
d
,
myMap
.
phi1
(
myMap
.
phi1
(
myMap
.
phi1
(
d
))));
myMap
.
check
();
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
position
[
i
]
+=
VEC3
(
0
,
2
,
0
);
...
...
@@ -112,12 +120,13 @@ void SimpleGMap3::cb_redraw()
glDisable
(
GL_LIGHTING
);
glLineWidth
(
1.0
f
);
Algo
::
Render
::
GL1
::
renderTopoGMD3
<
PFP
>
(
myMap
,
position
,
true
,
true
,
true
,
true
,
0.9
f
,
0.9
f
,
0.9
f
,
0.9
f
);
// Algo::Render::GL1::renderTopoMD3<PFP>(myMap, position, true, true, true, 0.9f, 0.9f, 0.9f);
glDisable
(
GL_LIGHTING
);
glColor3f
(
1.0
f
,
1.0
f
,
1.0
f
);
glLineWidth
(
1.0
f
);
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_LINE
);
Algo
::
Render
::
GL1
::
renderTriQuadPoly
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL1
::
LINE
,
1.0
,
position
,
normal
);
//
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);
}
/**********************************************************************************************
...
...
Apps/Examples/simpleGMap3.h
View file @
cb0ca9b0
...
...
@@ -28,6 +28,7 @@
#include "Topology/generic/parameters.h"
#include "Topology/gmap/embeddedGMap3.h"
//#include "Topology/map/embeddedMap3.h"
#include "Geometry/vector_gen.h"
...
...
@@ -40,6 +41,7 @@ struct PFP: public PFP_STANDARD
{
// definition of the map
typedef
EmbeddedGMap3
MAP
;
// typedef EmbeddedMap3 MAP ;
};
typedef
PFP
::
MAP
MAP
;
...
...
Apps/Examples/viewer.cpp
View file @
cb0ca9b0
...
...
@@ -185,7 +185,7 @@ void Viewer::cb_Open()
void
Viewer
::
cb_Save
()
{
std
::
string
filters
(
"all (*.*);; map (*.map);; off (*.off);; ply (*.ply)
;; plygen (*.plygen)
"
)
;
std
::
string
filters
(
"all (*.*);; map (*.map);; off (*.off);; ply (*.ply)"
)
;
std
::
string
filename
=
selectFileSave
(
"Save Mesh"
,
""
,
filters
)
;
exportMesh
(
filename
)
;
...
...
@@ -239,7 +239,7 @@ void Viewer::importMesh(std::string& filename)
updateGLMatrices
()
;
}
void
Viewer
::
exportMesh
(
std
::
string
&
filename
)
void
Viewer
::
exportMesh
(
std
::
string
&
filename
,
bool
askExportMode
)
{
size_t
pos
=
filename
.
rfind
(
"."
)
;
// position of "." in filename
std
::
string
extension
=
filename
.
substr
(
pos
)
;
...
...
@@ -248,9 +248,13 @@ void Viewer::exportMesh(std::string& filename)
Algo
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
(),
allDarts
)
;
else
if
(
extension
.
compare
(
0
,
4
,
std
::
string
(
".ply"
))
==
0
)
{
int
ascii
=
0
;
if
(
askExportMode
)
Utils
::
QT
::
inputValues
(
Utils
::
QT
::
VarCombo
(
"binary mode;ascii mode"
,
ascii
,
"Save in"
))
;
std
::
vector
<
VertexAttribute
<
VEC3
>*>
attributes
;
attributes
.
push_back
(
&
position
)
;
Algo
::
Export
::
exportPLYnew
<
PFP
>
(
myMap
,
attributes
,
filename
.
c_str
(),
true
,
allDarts
)
;
Algo
::
Export
::
exportPLYnew
<
PFP
>
(
myMap
,
attributes
,
filename
.
c_str
(),
!
ascii
,
allDarts
)
;
}
else
if
(
extension
==
std
::
string
(
".map"
))
myMap
.
saveMapBin
(
filename
)
;
...
...
@@ -307,6 +311,21 @@ void Viewer::slot_normalsSize(int i)
updateGL
()
;
}
void
Viewer
::
cb_keyPress
(
int
keycode
)
{
switch
(
keycode
)
{
case
'c'
:
myMap
.
check
();
break
;
default:
break
;
}
updateGLMatrices
()
;
updateGL
();
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
...
...
@@ -327,7 +346,7 @@ int main(int argc, char **argv)
{
std
::
string
filenameExp
(
argv
[
2
])
;
std
::
cout
<<
"Exporting "
<<
filename
<<
" as "
<<
filenameExp
<<
" ... "
<<
std
::
flush
;
sqt
.
exportMesh
(
filenameExp
)
;
sqt
.
exportMesh
(
filenameExp
,
false
)
;
std
::
cout
<<
"done!"
<<
std
::
endl
;
return
(
0
)
;
...
...
Apps/Examples/viewer.h
View file @
cb0ca9b0
...
...
@@ -46,6 +46,7 @@
#include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/pointSprite.h"
#include "Utils/text3d.h"
#include "Utils/Qt/qtInputs.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Geometry/normal.h"
...
...
@@ -117,8 +118,10 @@ public:
void
cb_Open
()
;
void
cb_Save
()
;
void
cb_keyPress
(
int
keycode
);
void
importMesh
(
std
::
string
&
filename
)
;
void
exportMesh
(
std
::
string
&
filename
);
void
exportMesh
(
std
::
string
&
filename
,
bool
askExportMode
=
true
);
public
slots
:
void
slot_drawVertices
(
bool
b
)
;
...
...
Apps/Examples/volumeExplorer.cpp
View file @
cb0ca9b0
...
...
@@ -319,6 +319,18 @@ int main(int argc, char **argv)
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
}
if
(
extension
==
std
::
string
(
".node"
))
{
if
(
!
Algo
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
,
Algo
::
Import
::
ImportVolumique
::
NODE
))
{
std
::
cerr
<<
"could not import "
<<
argv
[
1
]
<<
std
::
endl
;
return
1
;
}
else
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
}
if
(
extension
==
std
::
string
(
".off"
))
{
if
(
!
Algo
::
Import
::
importMeshToExtrude
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
))
...
...
Apps/Examples/volumeExplorer.h
View file @
cb0ca9b0
...
...
@@ -27,7 +27,7 @@
#include <iostream>
#define WITH_GMAP 1
//
#define WITH_GMAP 1
#include "Topology/generic/parameters.h"
#ifdef WITH_GMAP
...
...
Apps/Tuto/CMakeLists.txt
View file @
cb0ca9b0
...
...
@@ -34,7 +34,7 @@ QT4_WRAP_UI( tuto2_ui tuto2.ui )
QT4_WRAP_CPP
(
tuto2_moc tuto2.h
)
add_executable
(
tuto2 tuto2.cpp tuto2.h
${
tuto2_ui
}
${
tuto2_moc
}
)
target_link_libraries
(
tuto2
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
QtSvg
)
QT4_WRAP_CPP
(
tuto3_moc tuto3.h
)
add_executable
(
tuto3 tuto3.cpp
${
tuto3_moc
}
)
...
...
@@ -86,6 +86,12 @@ add_executable( tp_master tp_master.cpp ${tp_master_moc})
target_link_libraries
(
tp_master
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
QT4_WRAP_CPP
(
tuto_histo_moc tuto_histo.h
)
add_executable
(
tuto_histo tuto_histo.cpp tuto_histo.h
${
tuto_histo_ui
}
${
tuto_histo_moc
}
)
target_link_libraries
(
tuto_histo
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
QtSvg
)
#BOOST_LIBS macro: allow using compiled boost in windows (see readme)
# -first argument variable that will contain the libs
# -second argument list of boost libs separated by ; in " "
...
...
Apps/Tuto/tuto_histo.cpp
0 → 100644
View file @
cb0ca9b0
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, 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.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "tuto_histo.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Import/import.h"
#include "Algo/Geometry/area.h"
#include "Topology/generic/traversorCell.h"
#include <cmath>
#include <sstream>
using
namespace
CGoGN
;
int
main
(
int
argc
,
char
**
argv
)
{
// // interface
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
// copy output tout Qt console of application (shift enter)
CGoGNout
.
toConsole
(
&
sqt
);
// example code itself
sqt
.
createMap
(
std
::
string
(
argv
[
1
]));
// set help message in menu
sqt
.
setHelpMsg
(
"Tuto Histogram:
\n
Load mesh & compute histogram & quantiles
\n
+/- increase/decrease \
number of classes
\n
o/p increase/decrease number of quantiles
\n
w/x change \
min/max
\n
c center the histogram on 0
\n
h show/hide histogram
\n
q show/hide quantiles\
File/Save for exporting histogram in svg format"
);
// final show for redraw
sqt
.
show
();
// and wait for the end
return
app
.
exec
();
}
void
MyQT
::
createMap
(
const
std
::
string
&
filename
)
{
myMap
.
clear
(
true
)
;
size_t
pos
=
filename
.
rfind
(
"."
);
// position of "." in filename
std
::
string
extension
=
filename
.
substr
(
pos
);
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
}
VertexAttribute
<
VEC3
>
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
// attribute on which we make the histogram
VertexAttribute
<
float
>
area
=
myMap
.
addAttribute
<
float
,
VERTEX
>
(
"area"
);
// attribute color to generate from histo
VertexAttribute
<
VEC3
>
colorF
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"colorF"
);
// compute the area attribute
Algo
::
Geometry
::
computeOneRingAreaVertices
<
PFP
>
(
myMap
,
position
,
area
);
// just some tricks to obtain relatives value
float
amax
=
0
;
for
(
unsigned
int
i
=
area
.
begin
();
i
!=
area
.
end
();
area
.
next
(
i
))
if
(
area
[
i
]
>
amax
)
amax
=
area
[
i
];
for
(
unsigned
int
i
=
area
.
begin
();
i
!=
area
.
end
();
area
.
next
(
i
))
area
[
i
]
-=
amax
/
4
;
// create a colormap class for histogram coloring
l_cm
=
new
ColMap
();
// create the histogram
l_histo
=
new
Algo
::
Histogram
::
Histogram
(
*
l_cm
);
// init data with specific conversion (direction init is: l_histo->initData(area);)
AttConv
ac
(
area
);
l_histo
->
initDataConvert
(
ac
);
// compute the histogram
l_nbc
=
20
;
l_histo
->
populateHisto
(
l_nbc
);
//compute the quantiles
l_nbq
=
10
;
l_histo
->
populateQuantiles
(
l_nbq
);
// compute color attribute from histogram (histogram can alsdo directly update a VBO see below)
// l_histo->histoColorize(colorF);
// create a popup window
l_popup
=
new
Utils
::
QT
::
QtPopUp
(
this
);
// create the widget to view histogram
l_histodraw
=
new
Utils
::
QT
::
RenderHistogram
(
l_popup
,
*
l_histo
);
// some simple parameters
l_histodraw
->
setQuantilesDraw
(
true
);
l_histodraw
->
setHistoPosition
(
true
);
l_histodraw
->
setOpacity
(
0.6
f
);
// create a table of color
std
::
vector
<
Geom
::
Vec3f
>
colors
;
Utils
::
createTableColor01
(
colors
,
10
,
Utils
::
color_map_blue_green_red
);
// and us it to color the quantiles
l_histodraw
->
setQuantilesColors
(
colors
);
// add the widget to the popup
l_popup
->
addWidget
(
l_histodraw
,
0
,
0
);
l_popup
->
show
();
// connect the clicked signal of histogram widget to a slot
QObject
::
connect
(
l_histodraw
,
SIGNAL
(
clicked
(
unsigned
int
,
unsigned
int
)
),
this
,
SLOT
(
clickHisto
(
unsigned
int
,
unsigned
int
)
)
);
// bounding box of scene
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
float
lWidthObj
=
std
::
max
<
PFP
::
REAL
>
(
std
::
max
<
PFP
::
REAL
>
(
bb
.
size
(
0
),
bb
.
size
(
1
)),
bb
.
size
(
2
));
Geom
::
Vec3f
lPosObj
=
(
bb
.
min
()
+
bb
.
max
())
/
PFP
::
REAL
(
2
);
// send BB info to interface for centering on GL screen
setParamObject
(
lWidthObj
,
lPosObj
.
data
());
// first show for be sure that GL context is binded
show
();
// update of position VBO (context GL necessary)
m_positionVBO
->
updateData
(
position
);
// m_colorVBO2->updateData(colorF);
// histogram can directly update a VBO (warning GL context must be accessible, after the first show!)
l_histo
->
histoColorizeVBO
(
*
m_colorVBO2
);
// construct rendering primities
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
}
void
MyQT
::
cb_keyPress
(
int
keycode
)
{
switch
(
keycode
)
{
case
'+'
:
l_nbc
++
;
l_histo
->
populateHisto
(
l_nbc
);
l_histodraw
->
repaint
();
break
;
case
'-'
:
if
(
l_nbc
>
0
)
l_nbc
--
;
l_histo
->
populateHisto
(
l_nbc
);
l_histodraw
->
repaint
();
break
;
case
'p'
:
l_nbq
++
;
l_histo
->
populateQuantiles
(
l_nbq
);
l_histodraw
->
repaint
();
break
;
case
'o'
:
if
(
l_nbq
>
0
)
l_nbq
--
;
l_histo
->
populateQuantiles
(
l_nbq
);
l_histodraw
->
repaint
();
break
;
case
'q'
:
l_histodraw
->
setQuantilesDraw
(
!
l_histodraw
->
getQuantilesDraw
());
l_histodraw
->
repaint
();
break
;
case
'h'
:
l_histodraw
->
setHistoDraw
(
!
l_histodraw
->
getHistoDraw
());
l_histodraw
->
repaint
();
break
;
case
'c'
:
l_histo
->
centerOnZero
();
l_histo
->
populateHisto
(
l_nbc
);
l_histodraw
->
repaint
();
break
;
case
'w'
:
{
double
av
=
(
l_histo
->
getMin
()
+
l_histo
->
getMax
()
)
/
2.0
;
l_histo
->
setMin
(
av
*
0.1
+
l_histo
->
getMin
()
*
0.9
);
l_histo
->
setMax
(
av
*
0.1
+
l_histo
->
getMax
()
*
0.9
);
l_histo
->
populateHisto
(
l_nbc
);
l_histodraw
->
repaint
();
}
break
;
case
'x'
:
{
double
av
=
(
l_histo
->
getMin
()
+
l_histo
->
getMax
()
)
/
2.0
;
l_histo
->
setMin
(
-
0.1
*
av
+
l_histo
->
getMin
()
*
1.1
);
l_histo
->
setMax
(
-
0.1
*
av
+
l_histo
->
getMax
()
*
1.1
);
l_histo
->
populateHisto
(
l_nbc
);
l_histodraw
->
repaint
();
}
break
;
default:
break
;
}
}
void
MyQT
::
cb_initGL
()
{
// choose to use GL version 2
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
);
// create the render
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
();
// VBOs
m_positionVBO
=
new
Utils
::
VBO
();
m_colorVBO2
=
new
Utils
::
VBO
();
//shader
m_shader2
=
new
Utils
::
ShaderColorPerVertex
();
m_shader2
->
setAttributePosition
(
m_positionVBO
);
registerShader
(
m_shader2
);
}
void
MyQT
::
cb_redraw
()
{
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
// draw faces with pervertex color rendering
m_shader2
->
setAttributeColor
(
m_colorVBO2
);
m_render
->
draw
(
m_shader2
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
glDisable
(
GL_POLYGON_OFFSET_FILL
);
}
void
MyQT
::
clickHisto
(
unsigned
int
i
,
unsigned
int
j
)
{
std
::
cout
<<
"CLICK on column Histo: "
<<
i
<<
" / Quantiles: "
<<
j
<<
std
::
endl
;
if
(
i
!=
Utils
::
QT
::
RenderHistogram
::
NONE
)
{
std
::
vector
<
unsigned
int
>
vc
;
l_histo
->
cellsOfHistogramColumn
(
i
,
vc
);
std
::
cout
<<
"Cells of histo: "
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
vc
.
size
();
++
k
)
std
::
cout
<<
vc
[
k
]
<<
"/"
;
std
::
cout
<<
std
::
endl
;
CellMarker
<
VERTEX
>
cm
(
myMap
);
std
::
cout
<<
l_histo
->
markCellsOfHistogramColumn
(
i
,
cm
)
<<
" marked cells"
<<
std
::
endl
;
}
if
(
j
!=
Utils
::
QT
::
RenderHistogram
::
NONE
)
{
std
::
vector
<
unsigned
int
>
vc
;
l_histo
->
cellsOfHistogramColumn
(
j
,
vc
);
std
::
cout
<<
"Cells of quantile: "
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
vc
.
size
();
++
k
)
std
::
cout
<<
vc
[
k
]
<<
"/"
;
std
::
cout
<<
std
::
endl
;
}
}
void
MyQT
::
cb_Save
()
{
std
::
string
filename
=
selectFileSave
(
"export svg"
,
"."
,
"*.svg"
)
;
if
(
filename
.
empty
())
return
;
l_histodraw
->
svgExport
(
filename
);
}
void
MyQT
::
cb_exit
()
{
if
(
m_render
!=
NULL
)
delete
m_render
;
if
(
m_shader2
!=
NULL
)
delete
m_shader2
;
if
(
m_positionVBO
!=
NULL
)
delete
m_positionVBO
;
if
(
l_cm
!=
NULL
)
delete
l_cm
;
if
(
l_histo
!=
NULL
)
delete
l_histo
;
if
(
l_histodraw
!=
NULL
)
delete
l_histodraw
;
if
(
l_popup
!=
NULL
)
delete
l_popup
;
}
Apps/Tuto/tuto_histo.h
0 → 100644
View file @
cb0ca9b0
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, 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. *
* *