Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Cazier
CGoGN
Commits
e5f58387
Commit
e5f58387
authored
Jul 13, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of cgogn:CGoGN
parents
a319729c
7677a0f3
Changes
78
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
75 changed files
with
3193 additions
and
1711 deletions
+3193
-1711
Apps/Examples/simpleGMap3.cpp
Apps/Examples/simpleGMap3.cpp
+27
-18
Apps/Examples/simpleGMap3.h
Apps/Examples/simpleGMap3.h
+2
-0
Apps/Examples/volumeExplorer.h
Apps/Examples/volumeExplorer.h
+1
-1
Apps/Tuto/CMakeLists.txt
Apps/Tuto/CMakeLists.txt
+2
-2
Apps/Tuto/tuto_histo.cpp
Apps/Tuto/tuto_histo.cpp
+10
-0
Apps/Tuto/tuto_oper3.cpp
Apps/Tuto/tuto_oper3.cpp
+149
-13
Apps/Tuto/tuto_oper3.h
Apps/Tuto/tuto_oper3.h
+21
-2
Apps/Tuto/tuto_oper3.ui
Apps/Tuto/tuto_oper3.ui
+116
-103
Apps/deprecated/polyhedronsView.cpp
Apps/deprecated/polyhedronsView.cpp
+4
-4
CMakeLists.txt
CMakeLists.txt
+3
-2
README.TXT
README.TXT
+1
-1
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
+33
-5
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/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
+13
-3
include/Algo/Export/export.hpp
include/Algo/Export/export.hpp
+73
-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/volume.hpp
include/Algo/Geometry/volume.hpp
+1
-1
include/Algo/Histogram/histogram.h
include/Algo/Histogram/histogram.h
+4
-0
include/Algo/Import/import.h
include/Algo/Import/import.h
+10
-13
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
+22
-8
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/importTet.hpp
include/Algo/Import/importTet.hpp
+4
-5
include/Algo/Modelisation/polyhedron.h
include/Algo/Modelisation/polyhedron.h
+2
-3
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
+7
-1
include/Algo/Modelisation/tetrahedralization.hpp
include/Algo/Modelisation/tetrahedralization.hpp
+50
-12
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
+101
-0
include/Algo/Multiresolution/map2MR/map2MR_PM.hpp
include/Algo/Multiresolution/map2MR/map2MR_PM.hpp
+211
-0
include/Algo/Render/GL2/mapRender.hpp
include/Algo/Render/GL2/mapRender.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/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
+5
-0
include/Topology/map/map2MR/filters_Primal.h
include/Topology/map/map2MR/filters_Primal.h
+30
-30
include/Topology/map/map3.h
include/Topology/map/map3.h
+9
-1
include/Utils/qem.h
include/Utils/qem.h
+2
-1
src/Algo/Histogram/histogram.cpp
src/Algo/Histogram/histogram.cpp
+1
-1
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+1
-1
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+31
-0
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
No files found.
Apps/Examples/simpleGMap3.cpp
View file @
e5f58387
...
...
@@ -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 @
e5f58387
...
...
@@ -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/volumeExplorer.h
View file @
e5f58387
...
...
@@ -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 @
e5f58387
...
...
@@ -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
}
QtSvg
)
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
QT4_WRAP_CPP
(
tuto3_moc tuto3.h
)
add_executable
(
tuto3 tuto3.cpp
${
tuto3_moc
}
)
...
...
@@ -89,7 +89,7 @@ target_link_libraries( tp_master
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
)
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
#BOOST_LIBS macro: allow using compiled boost in windows (see readme)
...
...
Apps/Tuto/tuto_histo.cpp
View file @
e5f58387
...
...
@@ -173,12 +173,16 @@ void MyQT::cb_keyPress(int keycode)
l_nbc
++
;
l_histo
->
populateHisto
(
l_nbc
);
l_histodraw
->
repaint
();
l_histo
->
histoColorizeVBO
(
*
m_colorVBO2
);
updateGL
();
break
;
case
'-'
:
if
(
l_nbc
>
0
)
l_nbc
--
;
l_histo
->
populateHisto
(
l_nbc
);
l_histodraw
->
repaint
();
l_histo
->
histoColorizeVBO
(
*
m_colorVBO2
);
updateGL
();
break
;
case
'p'
:
...
...
@@ -205,6 +209,8 @@ void MyQT::cb_keyPress(int keycode)
l_histo
->
centerOnZero
();
l_histo
->
populateHisto
(
l_nbc
);
l_histodraw
->
repaint
();
l_histo
->
histoColorizeVBO
(
*
m_colorVBO2
);
updateGL
();
break
;
case
'w'
:
...
...
@@ -214,6 +220,8 @@ void MyQT::cb_keyPress(int keycode)
l_histo
->
setMax
(
av
*
0.1
+
l_histo
->
getMax
()
*
0.9
);
l_histo
->
populateHisto
(
l_nbc
);
l_histodraw
->
repaint
();
l_histo
->
histoColorizeVBO
(
*
m_colorVBO2
);
updateGL
();
}
break
;
case
'x'
:
...
...
@@ -223,6 +231,8 @@ void MyQT::cb_keyPress(int keycode)
l_histo
->
setMax
(
-
0.1
*
av
+
l_histo
->
getMax
()
*
1.1
);
l_histo
->
populateHisto
(
l_nbc
);
l_histodraw
->
repaint
();
l_histo
->
histoColorizeVBO
(
*
m_colorVBO2
);
updateGL
();
}
break
;
...
...
Apps/Tuto/tuto_oper3.cpp
View file @
e5f58387
...
...
@@ -45,6 +45,8 @@ int main(int argc, char **argv)
sqt
.
setCallBack
(
sqt
.
dock
.
listOper
,
SIGNAL
(
currentRowChanged
(
int
)),
SLOT
(
operation
(
int
))
);
sqt
.
setCallBack
(
sqt
.
dock
.
svg
,
SIGNAL
(
clicked
()),
SLOT
(
svg
())
);
sqt
.
setCallBack
(
sqt
.
dock
.
widthSlider
,
SIGNAL
(
valueChanged
(
int
)),
SLOT
(
width
(
int
))
);
sqt
.
setCallBack
(
sqt
.
dock
.
checkBox_hide
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
hide_onoff
(
bool
))
);
sqt
.
setCallBack
(
sqt
.
dock
.
checkBox_plane
,
SIGNAL
(
toggled
(
bool
)),
SLOT
(
clipping_onoff
(
bool
))
);
int
n
=
3
;
if
(
argc
==
2
)
n
=
atoi
(
argv
[
1
]);
...
...
@@ -62,6 +64,36 @@ int main(int argc, char **argv)
return
app
.
exec
();
}
void
MyQT
::
clipping_onoff
(
bool
x
)
{
clip_volume
=
x
;
if
(
clip_volume
)
{
Geom
::
Vec3f
pos
=
m_PlanePick
->
getPosition
();
float
pipo
;
Geom
::
Vec3f
normal
=
m_PlanePick
->
getAxisScale
(
2
,
pipo
);
// 2 = Z axis = plane normal
m_render_topo
->
shader1
()
->
setClipPlaneParamsAll
(
clip_id1
,
normal
,
pos
);
m_render_topo
->
shader2
()
->
setClipPlaneParamsAll
(
clip_id2
,
normal
,
pos
);
}
else
{
m_render_topo
->
shader1
()
->
setClipPlaneParamsAll
(
clip_id1
,
Geom
::
Vec3f
(
0
,
0
,
1
),
Geom
::
Vec3f
(
0
,
0
,
999999.9
f
));
m_render_topo
->
shader2
()
->
setClipPlaneParamsAll
(
clip_id2
,
Geom
::
Vec3f
(
0
,
0
,
1
),
Geom
::
Vec3f
(
0
,
0
,
999999.9
f
));
m_render_topo
->
shader1
()
->
setClipColorAttenuationFactorRelative
(
0.0
f
,
0.0
f
);
m_render_topo
->
shader2
()
->
setClipColorAttenuationFactorRelative
(
0.0
f
,
0.0
f
);
}
updateMap
();
updateGL
();
}
void
MyQT
::
hide_onoff
(
bool
x
)
{
hide_clipping
=
!
hide_clipping
;
updateMap
();
updateGL
();
}
void
MyQT
::
operation
(
int
x
)
{
switch
(
x
)
...
...
@@ -191,8 +223,8 @@ void MyQT::operation(int x)
Dart
dit
=
m_selecteds
.
front
();
PFP
::
VEC3
Q
=
(
position
[
myMap
.
phi1
(
m_selected
)]
+
position
[
m_selected
])
/
2.0
f
;
//PFP::VEC3 c1 = Algo::Geometry::volumeCentroid<PFP>(myMap, dit, position);
//
Dart dres = myMap.splitVertex(m_selecteds);
Dart
dres
=
Algo
::
Modelisation
::
Tetrahedralization
::
splitVertex
<
PFP
>
(
myMap
,
m_selecteds
);
Dart
dres
=
myMap
.
splitVertex
(
m_selecteds
);
//
Dart dres = Algo::Modelisation::Tetrahedralization::splitVertex<PFP>(myMap, m_selecteds);
position
[
dres
]
=
position
[
dit
]
+
Q
*
0.25
f
;
//position[dit] = position[dit] - c1*0.5f;
m_selecteds
.
clear
();
...
...
@@ -220,17 +252,8 @@ void MyQT::createMap(int n)
prim
.
hexaGrid_topo
(
n
,
n
,
n
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
);
// Dart d = Algo::Modelisation::createTetrahedron<PFP>(myMap);
// myMap.closeMap();
//
// position[d] = typename PFP::VEC3(0.0f, 0.0f, 0.0f);
// position[myMap.phi1(d)] = typename PFP::VEC3(0.0f, 1.0f, 0.0f);
// position[myMap.phi1(myMap.phi1(d))] = typename PFP::VEC3(1.0f, 0.5f, 0.0f);
// position[myMap.phi_1(myMap.phi2(d))] = typename PFP::VEC3(0.5f, 0.5f, 1.0f);
// bounding box of scene
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
setParamObject
(
bb
.
maxSize
(),
bb
.
center
().
data
())
;
m_shift
=
bb
.
maxSize
()
/
200.0
f
;
...
...
@@ -254,6 +277,20 @@ void MyQT::cb_initGL()
{
glClearColor
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
);
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
()
;
m_PlanePick
=
new
Utils
::
Pickable
(
Utils
::
Pickable
::
GRID
,
1
);
m_frame
=
new
Utils
::
FrameManipulator
();
m_frame
->
setSize
(
bb
.
maxSize
());
m_render_topo
->
shader1
()
->
insertClippingCode
();
m_render_topo
->
shader2
()
->
insertClippingCode
();
clip_id1
=
m_render_topo
->
shader1
()
->
addClipPlane
();
clip_id2
=
m_render_topo
->
shader2
()
->
addClipPlane
();
m_render_topo
->
shader1
()
->
setClipPlaneParamsAll
(
clip_id1
,
Geom
::
Vec3f
(
0
,
0
,
1
),
bb
.
center
());
m_render_topo
->
shader2
()
->
setClipPlaneParamsAll
(
clip_id2
,
Geom
::
Vec3f
(
0
,
0
,
1
),
bb
.
center
());
}
// redraw GL callback (clear and swap already done)
...
...
@@ -276,6 +313,12 @@ void MyQT::cb_redraw()
{
m_render_topo
->
overdrawDart
(
*
it
,
11
,
0.0
f
,
0.0
f
,
1.0
f
);
}
if
(
clip_volume
&&
!
hide_clipping
)
{
m_frame
->
draw
();
m_PlanePick
->
draw
();
}
}
void
MyQT
::
cb_mousePress
(
int
button
,
int
x
,
int
y
)
...
...
@@ -294,6 +337,29 @@ void MyQT::cb_mousePress(int button, int x, int y)
m_selected2
=
d
;
}
updateGL
();
if
(
hide_clipping
||
!
clip_volume
)
return
;
m_begX
=
x
;
m_begY
=
y
;
// get ray of selection
Geom
::
Vec3f
rayA
,
rayB
;
float
dist
=
getOrthoScreenRay
(
x
,
y
,
rayA
,
rayB
);
Geom
::
Vec3f
AB
=
rayB
-
rayA
;
unsigned
int
fr_picked
=
0
;
// picking the frame -> axis
fr_picked
=
m_frame
->
pick
(
rayA
,
AB
,
dist
);
if
(
fr_picked
!=
0
)
{
m_pickedAxis
=
fr_picked
;
m_frame
->
highlight
(
m_pickedAxis
);
m_frame
->
storeProjection
(
m_pickedAxis
);
updateGL
();
}
}
if
(
Control
())
...
...
@@ -308,6 +374,74 @@ void MyQT::cb_mousePress(int button, int x, int y)
}
}
void
MyQT
::
cb_mouseRelease
(
int
button
,
int
x
,
int
y
)
{
if
(
hide_clipping
||
!
clip_volume
)
return
;
m_pickedAxis
=
0
;
m_frame
->
highlight
(
m_pickedAxis
);
updateGL
();
}
void
MyQT
::
cb_mouseMove
(
int
buttons
,
int
x
,
int
y
)
{
if
(
!
Shift
())
return
;
if
(
hide_clipping
||
!
clip_volume
)
return
;
// rotation selected ?
if
(
Utils
::
FrameManipulator
::
rotationAxis
(
m_pickedAxis
))
{
if
(
buttons
&
1
)
{
float
angle
=
m_frame
->
angleFromMouse
(
x
,
y
,
x
-
m_begX
,
y
-
m_begY
);
m_frame
->
rotate
(
m_pickedAxis
,
angle
);
}
else
if
(
buttons
&
2
)
m_frame
->
rotateInScreen
(
x
-
m_begX
,
y
-
m_begY
);
m_PlanePick
->
transfo
()
=
m_frame
->
transfo
();
}
// translation selected
else
if
(
Utils
::
FrameManipulator
::
translationAxis
(
m_pickedAxis
))
{
if
(
buttons
&
1
)
{
float
dist
=
m_frame
->
distanceFromMouse
(
x
-
m_begX
,
y
-
m_begY
);
m_frame
->
translate
(
m_pickedAxis
,
dist
);
}
else
if
(
buttons
&
2
)
m_frame
->
translateInScreen
(
x
-
m_begX
,
y
-
m_begY
);
m_PlanePick
->
transfo
()
=
m_frame
->
transfo
();
}
// scale selected
else
if
(
Utils
::
FrameManipulator
::
scaleAxis
(
m_pickedAxis
)
)
{
float
scale
=
m_frame
->
scaleFromMouse
(
x
-
m_begX
,
y
-
m_begY
);
m_frame
->
scale
(
m_pickedAxis
,
scale
);
m_PlanePick
->
transfo
()
=
m_frame
->
transfo
();
}
Geom
::
Vec3f
pos
=
m_PlanePick
->
getPosition
();
float
pipo
;
Geom
::
Vec3f
normal
=
m_PlanePick
->
getAxisScale
(
2
,
pipo
);
// 2 = Z axis = plane normal
m_render_topo
->
shader1
()
->
setClipPlaneParamsAll
(
clip_id1
,
normal
,
pos
);
m_render_topo
->
shader2
()
->
setClipPlaneParamsAll
(
clip_id2
,
normal
,
pos
);
m_begX
=
x
;
m_begY
=
y
;
updateGL
();
return
;
}
void
MyQT
::
cb_keyPress
(
int
keycode
)
{
switch
(
keycode
)
...
...
@@ -521,10 +655,12 @@ void MyQT::importMesh(std::string& filename)
m_selected
=
NIL
;
m_selected2
=
NIL
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
setParamObject
(
bb
.
maxSize
(),
bb
.
center
().
data
())
;
m_shift
=
bb
.
maxSize
()
/
200.0
f
;
m_frame
->
setSize
(
bb
.
maxSize
());
updateMap
();
updateGLMatrices
()
;
}
...
...
Apps/Tuto/tuto_oper3.h
View file @
e5f58387
...
...
@@ -37,12 +37,13 @@
#endif
#include "Algo/Render/GL2/topo3Render.h"
#include "Algo/Geometry/boundingbox.h"
#include "ui_tuto_oper3.h"
#include "Utils/Qt/qtui.h"
#include "Utils/Qt/qtSimple.h"
#include "Utils/cgognStream.h"
#include "Utils/frameManipulator.h"
using
namespace
CGoGN
;
...
...
@@ -69,11 +70,13 @@ class MyQT: public Utils::QT::SimpleQT
{
Q_OBJECT
public:
MyQT
()
:
nb
(
myMap
),
m_render_topo
(
NULL
),
m_selected
(
NIL
),
m_selected2
(
NIL
),
dm
(
myMap
),
m_shift
(
0.01
f
),
m_ex1
(
0.9
f
),
m_ex2
(
0.9
f
),
m_ex3
(
0.9
f
)
{}
MyQT
()
:
nb
(
myMap
),
m_render_topo
(
NULL
),
m_selected
(
NIL
),
m_selected2
(
NIL
),
dm
(
myMap
),
m_shift
(
0.01
f
),
m_ex1
(
0.9
f
),
m_ex2
(
0.9
f
),
m_ex3
(
0.9
f
)
,
clip_volume
(
true
)
,
hide_clipping
(
false
)
{}
void
cb_redraw
();
void
cb_initGL
();
void
cb_mousePress
(
int
button
,
int
x
,
int
y
);
void
cb_mouseRelease
(
int
button
,
int
x
,
int
y
);
void
cb_mouseMove
(
int
button
,
int
x
,
int
y
);
void
cb_keyPress
(
int
code
);
void
cb_Open
();
void
cb_Save
();
...
...
@@ -88,6 +91,8 @@ protected:
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
;
// render (for the topo)
Algo
::
Render
::
GL2
::
Topo3Render
*
m_render_topo
;
Dart
m_selected
;
...
...
@@ -98,6 +103,17 @@ protected:
float
m_ex1
,
m_ex2
,
m_ex3
;
// for clipping plane manipulation
bool
clip_volume
;
bool
hide_clipping
;
Utils
::
Pickable
*
m_PlanePick
;
Utils
::
FrameManipulator
*
m_frame
;
unsigned
int
m_pickedAxis
;
int
m_begX
;
int
m_begY
;
int
clip_id1
;
int
clip_id2
;
// just for more compact writing
inline
Dart
PHI1
(
Dart
d
)
{
return
myMap
.
phi1
(
d
);}
inline
Dart
PHI_1
(
Dart
d
)
{
return
myMap
.
phi_1
(
d
);}
...
...
@@ -116,6 +132,9 @@ public slots:
void
operation
(
int
x
);
void
svg
();
void
width
(
int
w
);
void
clipping_onoff
(
bool
x
);
void
hide_onoff
(
bool
x
);
};
#endif
Apps/Tuto/tuto_oper3.ui
View file @
e5f58387
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
2
27
</width>
<height>
369
</height>
<width>
2
15
</width>
<height>
481
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
...
...
@@ -36,116 +36,129 @@
</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"
>
<widget
class=
"QSlider"
name=
"widthSlider"
>
<property
name=
"minimum"
>
<number>
0
</number>
</property>
<property
name=
"maximum"
>
<number>
10
</number>
</property>
<property
name=
"singleStep"
>
<number>
0
</number>
</property>
<property
name=
"value"
>
<number>
1
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item
row=
"7"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
113
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"svg"
>
<property
name=
"text"
>
<string>
SnapshotSVG
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
>
<widget
class=
"QCheckBox"
name=
"checkBox_hide"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
hide clipping plane
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<widget
class=
"QListWidget"
name=
"listOper"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<item>
<property
name=
"text"
>
<string>
deleteVertex
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
cutEdge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
uncutEdge
</string>
</property>
</item>
<item>
<widget
class=
"QListWidget"
name=
"listOper"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<item>
<property
name=
"text"
>
<string>
deleteVertex
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
cutEdge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
uncutEdge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
deleteEdge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
collapseEdge
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
splitFace
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
mergeVolume
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
splitVolume
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
collapseFace
</string>
</property>
</item>