Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CGoGN
CGoGN
Commits
8e42adeb
Commit
8e42adeb
authored
May 07, 2015
by
Pierre Kraemer
Browse files
Merge branch 'develop' into 'master'
Develop See merge request
!69
parents
0d9c95ae
f54353e0
Changes
148
Hide whitespace changes
Inline
Side-by-side
Apps/Benches/bench_compact.cpp
View file @
8e42adeb
...
...
@@ -72,7 +72,7 @@ int main(int argc, char **argv)
std
::
vector
<
VertexAttribute
<
typename
PFP
::
VEC3
,
MAP
>
>
attr
;
attr
.
push_back
(
position
);
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
*
0.05
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
/
20
)
;
VertexAttribute
<
PFP
::
VEC3
,
MAP
>
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
,
MAP
>
(
"normal"
)
;
VertexAttribute
<
PFP
::
VEC3
,
MAP
>
position2
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
,
MAP
>
(
"pos2"
)
;
...
...
Apps/Benches/bench_remesh.cpp
View file @
8e42adeb
...
...
@@ -54,19 +54,19 @@ int main(int argc, char **argv)
std
::
vector
<
VertexAttribute
<
typename
PFP
::
VEC3
,
MAP
>
>
attr
;
attr
.
push_back
(
position
);
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
*
0.1
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
/
10
)
;
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
)
;
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
)
;
nbVertices
=
Algo
::
Topo
::
getNbOrbits
<
VERTEX
>
(
myMap
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
*
0.1
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
/
10
)
;
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
)
;
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
)
;
nbVertices
=
Algo
::
Topo
::
getNbOrbits
<
VERTEX
>
(
myMap
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
*
0.1
)
;
Algo
::
Surface
::
Decimation
::
decimate
<
PFP
>
(
myMap
,
Algo
::
Surface
::
Decimation
::
S_QEM
,
Algo
::
Surface
::
Decimation
::
A_QEM
,
attr
,
nbVertices
/
10
)
;
Algo
::
Surface
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
>
(
myMap
,
position
)
;
Algo
::
Surface
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
>
(
myMap
,
position
)
;
...
...
Apps/Benches/bench_trav.cpp
View file @
8e42adeb
...
...
@@ -81,9 +81,11 @@ int main()
});
centerFace
/=
nbVert
;
centerVol
+=
centerFace
;
nbFaces
++
;
});
centerVol
/=
nbFaces
;
centerMesh
+=
centerVol
;
nbVols
++
;
});
centerMesh
/=
nbVols
;
CGoGNout
<<
"Traverse with foreach in "
<<
ch
.
elapsed
()
<<
" ms"
<<
CGoGNendl
;
...
...
@@ -110,9 +112,11 @@ int main()
}
centerFace
/=
nbVert
;
centerVol
+=
centerFace
;
nbFaces
++
;
}
centerVol
/=
nbFaces
;
centerMesh
+=
centerVol
;
nbVols
++
;
}
CGoGNout
<<
"Traverse with traversor in "
<<
ch
.
elapsed
()
<<
" ms"
<<
CGoGNendl
;
...
...
Apps/Examples/CMakeLists.txt
View file @
8e42adeb
...
...
@@ -40,7 +40,7 @@ qt_wrap_cpp( viewer_moc viewer.h )
add_executable
(
viewer viewer.cpp
${
viewer_moc
}
${
viewer_ui
}
)
target_link_libraries
(
viewer
${
CGoGN_LIBS
}
${
NUMERICAL_LIBS
}
${
CGoGN_EXT_LIBS
}
)
IF
(
CGoGN_GCC_4_9
)
IF
(
HAS_CPP11_REGEX
)
qt_wrap_ui
(
clipping_ui clipping.ui
)
qt_wrap_cpp
(
clipping_moc clipping.h
)
add_executable
(
clipping clipping.cpp
${
clipping_ui
}
${
clipping_moc
}
)
...
...
Apps/Examples/frame_manip.cpp
View file @
8e42adeb
...
...
@@ -134,9 +134,9 @@ void MyQT::cb_redraw()
for
(
std
::
vector
<
Utils
::
Pickable
*>::
iterator
it
=
m_pickables
.
begin
();
it
!=
m_pickables
.
end
();
++
it
)
{
if
(
*
it
==
m_lastPickedObject
)
gl
LineWidth
(
2
.0
);
(
*
it
)
->
set
LineWidth
(
3
.0
);
else
gl
LineWidth
(
1.0
);
(
*
it
)
->
set
LineWidth
(
1.0
);
(
*
it
)
->
draw
();
}
...
...
Apps/Examples/mcmesh.cpp
View file @
8e42adeb
...
...
@@ -29,7 +29,8 @@ MCMesh::MCMesh() :
m_drawFaces
(
true
),
m_render
(
NULL
),
m_flatShader
(
NULL
),
m_simpleColorShader
(
NULL
)
m_simpleColorShader
(
NULL
),
m_linesShader
(
NULL
)
{}
void
MCMesh
::
initGUI
()
...
...
@@ -58,31 +59,67 @@ void MCMesh::cb_initGL()
m_flatShader
->
setDiffuse
(
colDif
);
m_flatShader
->
setExplode
(
1.0
f
);
m_simpleColorShader
=
new
Utils
::
ShaderSimpleColor
();
m_simpleColorShader
->
setAttributePosition
(
m_positionVBO
);
//m_simpleColorShader = new Utils::ShaderSimpleColor();
//m_simpleColorShader->setAttributePosition(m_positionVBO);
m_linesShader
=
new
Utils
::
ShaderBoldLines
();
m_linesShader
->
setAttributePosition
(
m_positionVBO
);
registerShader
(
m_flatShader
);
registerShader
(
m_simpleColorShader
);
// registerShader(m_simpleColorShader);
registerShader
(
m_linesShader
);
m_dr
=
new
Utils
::
Drawer
();
m_dr
->
newList
();
m_dr
->
pointSize
(
4.0
f
);
m_dr
->
lineWidth
(
25.0
f
);
m_dr
->
begin
(
GL_LINES
);
m_dr
->
color3f
(
1.0
,
0.0
,
0.0
);
m_dr
->
vertex3f
(
15.0
,
15.0
,
65.0
);
m_dr
->
vertex3f
(
110.0
,
110.0
,
65.0
);
m_dr
->
color3f
(
0.0
,
1.0
,
0.0
);
m_dr
->
vertex3f
(
110.0
,
15.0
,
75.0
);
m_dr
->
vertex3f
(
15.0
,
110.0
,
75.0
);
m_dr
->
end
();
m_dr
->
endList
();
}
void
MCMesh
::
cb_redraw
()
{
glEnable
(
GL_BLEND
);
m_dr
->
callList
(
0.1
f
);
if
(
m_drawEdges
)
// {
// glLineWidth(1.0f);
// if (m_drawFaces)
// {
// Geom::Vec4f c(0.0f, 0.0f, 0.0f, 0.0f);
// m_simpleColorShader->setColor(c);
// }
// else
// {
// Geom::Vec4f c(1.0f, 1.0f, 0.0f, 0.0f);
// m_simpleColorShader->setColor(c);
// }
// m_render->draw(m_simpleColorShader, Algo::Render::GL2::LINES);
// }
{
gl
LineWidth
(
1
.0
f
);
m_linesShader
->
set
LineWidth
(
2
.0
f
);
if
(
m_drawFaces
)
{
Geom
::
Vec4f
c
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
);
m_
simpleColor
Shader
->
setColor
(
c
);
m_
lines
Shader
->
setColor
(
c
);
}
else
{
Geom
::
Vec4f
c
(
1.0
f
,
1.0
f
,
0.0
f
,
0.0
f
);
m_
simpleColor
Shader
->
setColor
(
c
);
m_
lines
Shader
->
setColor
(
c
);
}
m_render
->
draw
(
m_
simpleColor
Shader
,
Algo
::
Render
::
GL2
::
LINES
);
m_render
->
draw
(
m_
lines
Shader
,
Algo
::
Render
::
GL2
::
LINES
);
}
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glEnable
(
GL_LIGHTING
);
glEnable
(
GL_POLYGON_OFFSET_FILL
);
...
...
Apps/Examples/mcmesh.h
View file @
8e42adeb
...
...
@@ -39,9 +39,11 @@
#include
"Algo/Render/GL2/mapRender.h"
#include
"Utils/Shaders/shaderFlat.h"
#include
"Utils/Shaders/shaderSimpleColor.h"
#include
"Utils/Shaders/shaderBoldLines.h"
#include
"Utils/vbo.h"
#include
"Algo/Geometry/boundingbox.h"
#include
"Utils/drawer.h"
using
namespace
CGoGN
;
...
...
@@ -79,9 +81,14 @@ public:
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Utils
::
VBO
*
m_positionVBO
;
Utils
::
VBO
*
m_colorVBO
;
Utils
::
ShaderFlat
*
m_flatShader
;
Utils
::
ShaderSimpleColor
*
m_simpleColorShader
;
Utils
::
ShaderBoldLines
*
m_linesShader
;
Utils
::
Drawer
*
m_dr
;
DATATYPE
valLabel
;
SAlgo
::
MC
::
Image
<
DATATYPE
>*
myImg
;
...
...
Apps/Examples/volumeExplorer.cpp
View file @
8e42adeb
...
...
@@ -218,6 +218,7 @@ void MyQT::cb_initGL()
registerShader
(
m_explode_render
->
shaderLines
());
m_PlanePick
=
new
Utils
::
Pickable
(
Utils
::
Pickable
::
GRID
,
1
);
m_PlanePick
->
drawable
()
->
setColor
(
Geom
::
Vec4f
(
1.0
f
,
1.0
f
,
0.0
f
,
0.0
f
));
m_frame
=
new
Utils
::
FrameManipulator
();
m_frame
->
setSize
(
m_WidthObj
/
2.0
f
);
...
...
@@ -254,6 +255,7 @@ void MyQT::cb_redraw()
if
(
clip_volume
&&
!
hide_clipping
)
{
m_frame
->
draw
();
m_PlanePick
->
setLineWidth
(
2.0
f
);
m_PlanePick
->
draw
();
}
...
...
Apps/SandBox/testPlaneCutting.cpp
View file @
8e42adeb
...
...
@@ -204,7 +204,7 @@ void Viewer::cb_keyPress(int keycode)
{
std
::
cout
<<
"PlaneCut"
<<
std
::
endl
;
Geom
::
Vec3f
n
(
0.1
,
0.1
,
1.0
);
Geom
::
Vec3f
n
(
0.1
f
,
0.1
f
,
1.0
f
);
Geom
::
Vec3f
o
=
bb
.
center
();
Geom
::
Plane3D
<
PFP
::
REAL
>
plan
(
n
,
o
);
...
...
@@ -239,7 +239,7 @@ void Viewer::cb_keyPress(int keycode)
{
std
::
cout
<<
"PlaneCut"
<<
std
::
endl
;
Geom
::
Vec3f
n
(
0.1
,
0.1
,
1.0
);
Geom
::
Vec3f
n
(
0.1
f
,
0.1
f
,
1.0
f
);
Geom
::
Vec3f
o
=
bb
.
center
();
Geom
::
Plane3D
<
PFP
::
REAL
>
plan
(
n
,
o
);
...
...
Apps/SandBox/tilings.cpp
View file @
8e42adeb
...
...
@@ -119,7 +119,7 @@ void MyQT::squareTiling(int code)
{
std
::
cout
<<
"square grid twisted strip tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
10
,
10
,
true
);
g
.
embedIntoTwistedStrip
(
position
,
0.2
,
0.7
,
5
);
g
.
embedIntoTwistedStrip
(
position
,
0.2
f
,
0.7
f
,
5
);
Geom
::
Matrix44f
trf
;
trf
.
identity
();
...
...
@@ -151,11 +151,11 @@ void MyQT::squareTiling(int code)
{
std
::
cout
<<
"square cylinder tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
1.0
);
c
.
embedIntoCylinder
(
position
,
0.5
f
,
0.7
f
,
1.0
f
);
Geom
::
Matrix44f
trf
;
trf
.
identity
();
Geom
::
translate
<
float
>
(
0.5
,
0.5
,
0.0
,
trf
);
Geom
::
translate
<
float
>
(
0.5
f
,
0.5
f
,
0.0
f
,
trf
);
c
.
transform
(
position
,
trf
);
...
...
@@ -169,7 +169,7 @@ void MyQT::squareTiling(int code)
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleBottom
();
c
.
triangleTop
();
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
1.0
);
c
.
embedIntoCylinder
(
position
,
0.5
f
,
0.7
f
,
1.0
f
);
break
;
}
...
...
@@ -212,7 +212,7 @@ void MyQT::squareTiling(int code)
{
std
::
cout
<<
"square tore tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Tore
<
PFP
>
c
(
myMap
,
20
,
10
);
c
.
embedIntoTore
(
position
,
0.9
,
0.5
);
c
.
embedIntoTore
(
position
,
0.9
f
,
0.5
f
);
c
.
exportPositions
(
position
,
"tore.bs"
);
break
;
...
...
@@ -244,7 +244,7 @@ void MyQT::triangularTiling(int code)
{
std
::
cout
<<
"triangle grid twisted strip tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Grid
<
PFP
>
g
(
myMap
,
10
,
10
,
true
);
g
.
embedIntoTwistedStrip
(
position
,
0.3
,
0.8
,
5
);
g
.
embedIntoTwistedStrip
(
position
,
0.3
f
,
0.8
f
,
5
);
break
;
}
...
...
@@ -252,7 +252,7 @@ void MyQT::triangularTiling(int code)
{
std
::
cout
<<
"triangle grid helocoid tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Grid
<
PFP
>
g
(
myMap
,
20
,
20
,
true
);
g
.
embedIntoHelicoid
(
position
,
0.3
,
0.8
,
5.0
,
2.0
);
g
.
embedIntoHelicoid
(
position
,
0.3
f
,
0.8
f
,
5.0
f
,
2.0
f
);
break
;
}
...
...
@@ -260,7 +260,7 @@ void MyQT::triangularTiling(int code)
{
std
::
cout
<<
"triangle cylinder tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
5.0
);
c
.
embedIntoCylinder
(
position
,
0.5
f
,
0.7
f
,
5.0
f
);
break
;
}
...
...
@@ -270,7 +270,7 @@ void MyQT::triangularTiling(int code)
Algo
::
Surface
::
Tilings
::
Triangular
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleBottom
();
c
.
triangleTop
();
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
5.0
);
c
.
embedIntoCylinder
(
position
,
0.5
f
,
0.7
f
,
5.0
f
);
break
;
}
...
...
@@ -280,7 +280,7 @@ void MyQT::triangularTiling(int code)
Algo
::
Surface
::
Tilings
::
Triangular
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleTop
();
c
.
triangleBottom
();
c
.
embedIntoSphere
(
position
,
0.5
);
c
.
embedIntoSphere
(
position
,
0.5
f
);
break
;
}
...
...
@@ -290,7 +290,7 @@ void MyQT::triangularTiling(int code)
Algo
::
Surface
::
Tilings
::
Triangular
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleTop
();
c
.
triangleBottom
();
c
.
embedIntoCone
(
position
,
0.5
,
5.0
);
c
.
embedIntoCone
(
position
,
0.5
f
,
5.0
f
);
break
;
}
...
...
@@ -298,7 +298,7 @@ void MyQT::triangularTiling(int code)
{
std
::
cout
<<
"triangle cube tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Cube
<
PFP
>
c
(
myMap
,
4
,
4
,
4
);
c
.
embedIntoCube
(
position
,
5.0
,
5.0
,
5.0
);
c
.
embedIntoCube
(
position
,
5.0
f
,
5.0
f
,
5.0
f
);
break
;
}
...
...
@@ -306,7 +306,7 @@ void MyQT::triangularTiling(int code)
{
std
::
cout
<<
"triangle tore tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Triangular
::
Tore
<
PFP
>
c
(
myMap
,
20
,
10
);
c
.
embedIntoTore
(
position
,
5.0
,
2.0
);
c
.
embedIntoTore
(
position
,
5.0
f
,
2.0
f
);
break
;
}
...
...
Apps/Tests/Geom_inclusion.cpp
View file @
8e42adeb
...
...
@@ -82,7 +82,7 @@ int main()
std
::
cout
<<
"Check arePointsEquals : Start"
<<
std
::
endl
;
VEC3
p1
(
0
,
0
,
0
);
VEC3
p2
(
0.1
,
0.1
,
0.1
);
VEC3
p2
(
0.1
f
,
0.1
f
,
0.1
f
);
if
(
!
Geom
::
arePointsEquals
<
VEC3
>
(
p1
,
p1
)
||
!
Geom
::
arePointsEquals
<
VEC3
>
(
p2
,
p2
)
||
Geom
::
arePointsEquals
<
VEC3
>
(
p1
,
p2
)
||
Geom
::
arePointsEquals
<
VEC3
>
(
p2
,
p1
))
{
...
...
Apps/Tuto/Modelling/tuto_oper2.cpp
View file @
8e42adeb
...
...
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
// example code itself
sqt
.
createMap
(
n
);
sqt
.
width
(
5
);
sqt
.
width
(
4.0
);
// set help message in menu
sqt
.
setHelpMsg
(
"First Tuto:
\n
Create two faces
\n
sew them
\n
and affect positions"
);
...
...
@@ -236,14 +236,11 @@ void MyQT::cb_redraw()
glDepthFunc
(
GL_LESS
);
m_render_topo
->
drawTopo
();
glDepthFunc
(
GL_LEQUAL
);
m_render_topo
->
drawColoredDarts
<
MAP
>
(
myMap
);
if
(
m_selected
!=
NIL
)
m_render_topo
->
overdrawDart
(
myMap
,
m_selected
,
11
,
1.0
f
,
0.0
f
,
0.0
f
);
if
(
m_selected2
!=
NIL
)
m_render_topo
->
overdrawDart
(
myMap
,
m_selected2
,
11
,
0.0
f
,
1.0
f
,
0.0
f
);
if
(
!
m_selecteds
.
empty
())
{
...
...
@@ -251,7 +248,7 @@ void MyQT::cb_redraw()
m_render_topo
->
overdrawDart
(
myMap
,
*
it
,
11
,
0.0
f
,
0.0
f
,
1.0
f
);
}
m_render_topo
->
overdrawDart
(
myMap
,
m_selected2
,
11
,
0.0
f
,
1.0
f
,
0.0
f
);
}
...
...
Apps/Tuto/Modelling/tuto_oper3.cpp
View file @
8e42adeb
...
...
@@ -61,6 +61,7 @@ int main(int argc, char **argv)
// final show for redraw
sqt
.
show
();
// and wait for the end
sqt
.
clipping_onoff
(
true
);
return
app
.
exec
();
}
...
...
@@ -73,21 +74,14 @@ void MyQT::clipping_onoff(bool x)
Geom
::
Vec3f
pos
=
m_PlanePick
->
getPosition
();
float
pipo
;
Geom
::
Vec3f
normal
=
m_PlanePick
->
getAxisScale
(
2
,
pipo
);
// 2 = Z axis = plane normal
m_sh1
->
setClipPlaneParamsAll
(
clip_id1
,
normal
,
pos
);
m_sh2
->
setClipPlane
ParamsAll
(
clip_id2
,
normal
,
pos
);
m_sh3
->
setClipPlane
ParamsAll
(
clip_id3
,
normal
,
pos
);
float
d
=
-
(
pos
*
normal
);
m_render_topo
->
setClip
ping
Plane
(
Geom
::
Vec4f
(
normal
[
0
],
normal
[
1
]
,
normal
[
2
],
d
)
);
m_render_topo_boundary
->
setClip
ping
Plane
(
Geom
::
Vec4f
(
normal
[
0
],
normal
[
1
],
normal
[
2
],
d
)
);
}
else
{
m_sh1
->
setClipPlaneParamsAll
(
clip_id1
,
Geom
::
Vec3f
(
0
,
0
,
1
),
Geom
::
Vec3f
(
0
,
0
,
999999.9
f
));
m_sh2
->
setClipPlaneParamsAll
(
clip_id2
,
Geom
::
Vec3f
(
0
,
0
,
1
),
Geom
::
Vec3f
(
0
,
0
,
999999.9
f
));
m_sh3
->
setClipPlaneParamsAll
(
clip_id3
,
Geom
::
Vec3f
(
0
,
0
,
1
),
Geom
::
Vec3f
(
0
,
0
,
999999.9
f
));
m_sh1
->
setClipColorAttenuationFactorRelative
(
0.0
f
,
0.0
f
);
m_sh2
->
setClipColorAttenuationFactorRelative
(
0.0
f
,
0.0
f
);
m_sh3
->
setClipColorAttenuationFactorRelative
(
0.0
f
,
0.0
f
);
}
{
m_render_topo
->
setNoClippingPlane
();
}
updateMap
();
updateGL
();
}
...
...
@@ -377,23 +371,6 @@ void MyQT::cb_initGL()
m_PlanePick
=
new
Utils
::
Pickable
(
Utils
::
Pickable
::
GRID
,
1
);
m_frame
=
new
Utils
::
FrameManipulator
();
m_frame
->
setSize
(
bb
.
maxSize
());
m_sh1
=
static_cast
<
Utils
::
ClippingShader
*>
(
m_render_topo
->
shader1
());
m_sh2
=
static_cast
<
Utils
::
ClippingShader
*>
(
m_render_topo
->
shader2
());
m_sh3
=
static_cast
<
Utils
::
ClippingShader
*>
(
m_render_topo_boundary
->
shader1
());
m_sh1
->
insertClippingCode
();
m_sh2
->
insertClippingCode
();
m_sh3
->
insertClippingCode
();
clip_id1
=
m_sh1
->
addClipPlane
();
clip_id2
=
m_sh2
->
addClipPlane
();
clip_id3
=
m_sh3
->
addClipPlane
();
m_sh1
->
setClipPlaneParamsAll
(
clip_id1
,
Geom
::
Vec3f
(
0
,
0
,
1
),
bb
.
center
());
m_sh2
->
setClipPlaneParamsAll
(
clip_id2
,
Geom
::
Vec3f
(
0
,
0
,
1
),
bb
.
center
());
m_sh3
->
setClipPlaneParamsAll
(
clip_id3
,
Geom
::
Vec3f
(
0
,
0
,
1
),
bb
.
center
());
}
// redraw GL callback (clear and swap already done)
...
...
@@ -554,11 +531,9 @@ void MyQT::cb_mouseMove(int buttons, int x, int y)
Geom
::
Vec3f
pos
=
m_PlanePick
->
getPosition
();
float
pipo
;
Geom
::
Vec3f
normal
=
m_PlanePick
->
getAxisScale
(
2
,
pipo
);
// 2 = Z axis = plane normal
m_sh1
->
setClipPlaneParamsAll
(
clip_id1
,
normal
,
pos
);
m_sh2
->
setClipPlaneParamsAll
(
clip_id2
,
normal
,
pos
);
m_sh3
->
setClipPlaneParamsAll
(
clip_id3
,
normal
,
pos
);
float
d
=
-
(
pos
*
normal
);
m_render_topo
->
setClippingPlane
(
Geom
::
Vec4f
(
normal
[
0
],
normal
[
1
],
normal
[
2
],
d
));
m_render_topo_boundary
->
setClippingPlane
(
Geom
::
Vec4f
(
normal
[
0
],
normal
[
1
],
normal
[
2
],
d
));
m_begX
=
x
;
m_begY
=
y
;
...
...
Apps/Tuto/Modelling/tuto_oper3.h
View file @
8e42adeb
...
...
@@ -133,10 +133,6 @@ protected:
int
clip_id2
;
int
clip_id3
;
Utils
::
ClippingShader
*
m_sh1
;
Utils
::
ClippingShader
*
m_sh2
;
Utils
::
ClippingShader
*
m_sh3
;
public:
// example of simple map creation
void
createMap
(
int
n
);
...
...
CGoGN/include/.gitignore
View file @
8e42adeb
...
...
@@ -2,4 +2,9 @@
cgogn_gmx.h
cgogn_mr.h
cgogn_onelib.h
cgogn_assimp.h
cgogn_defs.h
cgogn_ext_includes.h
cgogn_ext_libs.h
cgogn_qt.h
cgogn_zinri.h
CGoGN/include/Algo/Decimation/edgeSelector.h
View file @
8e42adeb
...
...
@@ -354,6 +354,7 @@ private:
VertexAttribute
<
VEC3
,
MAP
>
normal
;
EdgeAttribute
<
EdgeInfo
,
MAP
>
edgeInfo
;
EdgeAttribute
<
REAL
,
MAP
>
edgeangle
;
EdgeAttribute
<
REAL
,
MAP
>
edgearea
;
VertexAttribute
<
REAL
,
MAP
>
kmax
;
VertexAttribute
<
REAL
,
MAP
>
kmin
;
VertexAttribute
<
VEC3
,
MAP
>
Kmax
;
...
...
@@ -374,7 +375,7 @@ public:
m_positionApproximator
(
posApprox
)
{
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
m
,
pos
)
;
radius
=
bb
.
diagSize
()
*
0.003
;
radius
=
bb
.
diagSize
()
*
0.003
f
;
normal
=
m
.
template
getAttribute
<
VEC3
,
VERTEX
,
MAP
>(
"normal"
)
;
if
(
!
normal
.
isValid
())
...
...
@@ -390,6 +391,13 @@ public:
Algo
::
Surface
::
Geometry
::
computeAnglesBetweenNormalsOnEdges
<
PFP
>
(
m
,
pos
,
edgeangle
)
;
}
edgearea
=
m
.
template
getAttribute
<
REAL
,
EDGE
,
MAP
>(
"edgearea"
)
;
if
(
!
edgearea
.
isValid
())
{
edgearea
=
m
.
template
addAttribute
<
REAL
,
EDGE
,
MAP
>(
"edgearea"
)
;
Algo
::
Surface
::
Geometry
::
computeAreaEdges
<
PFP
>
(
m
,
pos
,
edgearea
)
;
}
kmax
=
m
.
template
getAttribute
<
REAL
,
VERTEX
,
MAP
>(
"kmax"
)
;
kmin
=
m
.
template
getAttribute
<
REAL
,
VERTEX
,
MAP
>(
"kmin"
)
;
Kmax
=
m
.
template
getAttribute
<
VEC3
,
VERTEX
,
MAP
>(
"Kmax"
)
;
...
...
@@ -404,7 +412,7 @@ public:
Kmax
=
m
.
template
addAttribute
<
VEC3
,
VERTEX
,
MAP
>(
"Kmax"
)
;
Kmin
=
m
.
template
addAttribute
<
VEC3
,
VERTEX
,
MAP
>(
"Kmin"
)
;
Knormal
=
m
.
template
addAttribute
<
VEC3
,
VERTEX
,
MAP
>(
"Knormal"
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertices_NormalCycles
<
PFP
>
(
m
,
radius
,
pos
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertices_NormalCycles
<
PFP
>
(
m
,
radius
,
pos
,
normal
,
edgeangle
,
edgearea
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
}
edgeInfo
=
m
.
template
addAttribute
<
EdgeInfo
,
EDGE
,
MAP
>(
"edgeInfo"
)
;
...
...
@@ -412,6 +420,7 @@ public:
~
EdgeSelector_Curvature
()
{
// this->m_map.removeAttribute(edgeangle) ;
// this->m_map.removeAttribute(edgearea) ;
// this->m_map.removeAttribute(kmax) ;
// this->m_map.removeAttribute(kmin) ;
// this->m_map.removeAttribute(Kmax) ;
...
...
@@ -452,6 +461,7 @@ private:
EdgeAttribute
<
EdgeInfo
,
MAP
>
edgeInfo
;
EdgeAttribute
<
REAL
,
MAP
>
edgeangle
;
EdgeAttribute
<
REAL
,
MAP
>
edgearea
;
std
::
multimap
<
float
,
Dart
>
edges
;
typename
std
::
multimap
<
float
,
Dart
>::
iterator
cur
;
...
...
@@ -473,11 +483,19 @@ public:
Algo
::
Surface
::
Geometry
::
computeAnglesBetweenNormalsOnEdges
<
PFP
>
(
m
,
pos
,
edgeangle
)
;
}
edgearea
=
m
.
template
getAttribute
<
REAL
,
EDGE
,
MAP
>(
"edgearea"
)
;
if
(
!
edgearea
.
isValid
())
{
edgearea
=
m
.
template
addAttribute
<
REAL
,
EDGE
,
MAP
>(
"edgearea"
)
;
Algo
::
Surface
::
Geometry
::
computeAreaEdges
<
PFP
>
(
m
,
pos
,
edgearea
)
;
}
edgeInfo
=
m
.
template
addAttribute
<
EdgeInfo
,
EDGE
,
MAP
>(
"edgeInfo"
)
;
}
~
EdgeSelector_CurvatureTensor
()
{
// this->m_map.removeAttribute(edgeangle) ;
// this->m_map.removeAttribute(edgearea) ;
this
->
m_map
.
removeAttribute
(
edgeInfo
)
;
}
SelectorType
getType
()
{
return
S_CurvatureTensor
;
}
...
...
CGoGN/include/Algo/Decimation/edgeSelector.hpp
View file @
8e42adeb
...
...
@@ -84,8 +84,8 @@ bool EdgeSelector_Random<PFP>::init()
for
(
Dart
d
=
m
.
begin
();
d
!=
m
.
end
();
m
.
next
(
d
))
darts
.
push_back
(
d
)
;
srand
(
time
(
NULL
))
;
int
remains
=
darts
.
size
()
;
srand
(
(
unsigned
int
)(
time
(
NULL
))
)
;
int
remains
=
int
(
darts
.
size
()
)
;
for
(
unsigned
int
i
=
0
;
i
<
darts
.
size
()
-
1
;
++
i
)
// generate the random permutation
{
int
r
=
(
rand
()
%
remains
)
+
i
;
...
...
@@ -1022,14 +1022,14 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
MAP
&
m
=
this
->
m_map
;
normal
[
d2
]
=
Algo
::
Surface
::
Geometry
::
vertexNormal
<
PFP
>
(
m
,
d2
,
m_position
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
d2
,
radius
,
m_position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
d2
,
radius
,
m_position
,
normal
,
edgeangle
,
edgearea
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
Dart
vit
=
d2
;
do
{
Dart
nVert
=
m
.
phi1
(
vit
)
;
normal
[
nVert
]
=
Algo
::
Surface
::
Geometry
::
vertexNormal
<
PFP
>
(
m
,
nVert
,
m_position
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
nVert
,
radius
,
m_position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
nVert
,
radius
,
m_position
,
normal
,
edgeangle
,
edgearea
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
updateEdgeInfo
(
m
.
phi1
(
vit
),
false
)
;
// must recompute some edge infos in the
if
(
vit
==
d2
||
vit
==
dd2
)
// neighborhood of the collapsed edge
...
...
@@ -1131,7 +1131,7 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
// compute things on the coarse version of the mesh
normal
[
newV
]
=
Algo
::
Surface
::
Geometry
::
vertexNormal
<
PFP
>
(
m
,
d2
,
m_position
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
d2
,
radius
,
m_position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
Algo
::
Surface
::
Geometry
::
computeCurvatureVertex_NormalCycles
<
PFP
>
(
m
,
d2
,
radius
,
m_position
,
normal
,
edgeangle
,
edgearea
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
)
;
// VEC3 norm = normal[newV] ;
REAL
mCurv
=
(
kmax
[
newV
]
+
kmin
[
newV
])
/
REAL
(
2
)
;
...
...
@@ -1330,7 +1330,7 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
MATRIX
tens1
;
Algo
::
Surface
::
Selection
::
Collector_OneRing_AroundEdge
<
PFP
>
col1
(
m
);