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
David Cazier
CGoGN
Commits
749f6086
Commit
749f6086
authored
Dec 08, 2011
by
untereiner
Browse files
deleteEdge+collapseEdge Map3 !!
parent
b70a54c5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Apps/Tuto/tuto5.cpp
View file @
749f6086
...
...
@@ -24,60 +24,22 @@
#include
"tuto5.h"
#include
<iostream>
#include
"Topology/generic/parameters.h"
#include
"Topology/map/embeddedMap3.h"
#include
"Geometry/vector_gen.h"
#include
"Algo/Geometry/boundingbox.h"
#include
"Algo/Render/GL2/mapRender.h"
#include
"Utils/Shaders/shaderSimpleColor.h"
#include
"Algo/Modelisation/primitives3d.h"
#include
"Algo/Modelisation/polyhedron.h"
#include
"Algo/Modelisation/subdivision.h"
#include
"Algo/Render/GL2/topo3Render.h"
#include
"Topology/generic/cellmarker.h"
#include
"Utils/text3d.h"
#include
"Utils/pointSprite.h"
#include
"Utils/Shaders/shaderVectorPerVertex.h"
#include
"Utils/cgognStream.h"
#include
"Algo/Render/SVG/mapSVGRender.h"
using
namespace
CGoGN
;
struct
PFP
:
public
PFP_STANDARD
{
// definition de la carte
typedef
EmbeddedMap3
MAP
;
//typedef Map3 MAP;
};
PFP
::
MAP
myMap
;
PFP
::
TVEC3
position
;
Dart
dglobal
;
void
MyQT
::
balls_onoff
(
bool
x
)
void
Tuto5
::
balls_onoff
(
bool
x
)
{
render_balls
=
!
render_balls
;
updateGL
();
CGoGNerr
<<
" balls_onoff "
<<
CGoGNendl
;
}
void
MyQT
::
vectors_onoff
(
bool
x
)
void
Tuto5
::
vectors_onoff
(
bool
x
)
{
render_vectors
=
!
render_vectors
;
updateGL
();
CGoGNerr
<<
" vectors_onoff "
<<
CGoGNflush
;
}
void
MyQT
::
text_onoff
(
bool
x
)
void
Tuto5
::
text_onoff
(
bool
x
)
{
render_text
=
!
render_text
;
updateGL
();
...
...
@@ -85,34 +47,32 @@ void MyQT::text_onoff(bool x)
}
void
MyQT
::
topo_onoff
(
bool
x
)
void
Tuto5
::
topo_onoff
(
bool
x
)
{
render_topo
=
!
render_topo
;
updateGL
();
CGoGNerr
<<
" topo_onoff "
<<
CGoGNflush
;
}
void
MyQT
::
slider_balls
(
int
x
)
void
Tuto5
::
slider_balls
(
int
x
)
{
m_sprite
->
setSize
(
0.05
f
*
x
);
updateGL
();
}
void
MyQT
::
slider_vectors
(
int
x
)
void
Tuto5
::
slider_vectors
(
int
x
)
{
m_lines
->
setScale
(
0.02
*
x
);
updateGL
();
}
void
MyQT
::
slider_text
(
int
x
)
void
Tuto5
::
slider_text
(
int
x
)
{
m_strings
->
setScale
(
0.02
f
*
x
);
updateGL
();
}
void
MyQT
::
animate
()
void
Tuto5
::
animate
()
{
// transfoMatrix() = glm::rotate(transfoMatrix(), 0.5f, glm::vec3(0.5773f,0.5773f,0.5773f));
transfoRotate
(
0.5
f
,
0.5773
f
,
0.5773
f
,
0.5773
f
);
...
...
@@ -120,11 +80,11 @@ void MyQT::animate()
}
void
MyQT
::
storeVerticesInfo
()
void
Tuto5
::
storeVerticesInfo
()
{
CellMarker
mv
(
m
yMap
,
VERTEX
);
for
(
Dart
d
=
m
yMap
.
begin
();
d
!=
m
yMap
.
end
();
m
yMap
.
next
(
d
))
CellMarker
mv
(
m
,
VERTEX
);
for
(
Dart
d
=
m
.
begin
();
d
!=
m
.
end
();
m
.
next
(
d
))
{
if
(
!
mv
.
isMarked
(
d
))
{
...
...
@@ -136,7 +96,7 @@ void MyQT::storeVerticesInfo()
}
}
void
MyQT
::
cb_initGL
()
void
Tuto5
::
cb_initGL
()
{
// choose to use GL version 2
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
);
...
...
@@ -184,11 +144,11 @@ void MyQT::cb_initGL()
registerShader
(
m_sprite
);
registerShader
(
m_lines
);
m_render
->
initPrimitives
<
PFP
>
(
m
yMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
m_render
->
initPrimitives
<
PFP
>
(
m
yMap
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
);
m_render
->
initPrimitives
<
PFP
>
(
m
yMap
,
allDarts
,
Algo
::
Render
::
GL2
::
POINTS
);
m_render
->
initPrimitives
<
PFP
>
(
m
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
m_render
->
initPrimitives
<
PFP
>
(
m
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
);
m_render
->
initPrimitives
<
PFP
>
(
m
,
allDarts
,
Algo
::
Render
::
GL2
::
POINTS
);
m_render_topo
->
updateData
<
PFP
>
(
m
yMap
,
allDarts
,
position
,
0.9
f
,
0.9
f
,
0.9
f
);
m_render_topo
->
updateData
<
PFP
>
(
m
,
allDarts
,
position
,
0.9
f
,
0.9
f
,
0.9
f
);
// timer example for animation
...
...
@@ -196,7 +156,7 @@ void MyQT::cb_initGL()
connect
(
m_timer
,
SIGNAL
(
timeout
()),
SLOT
(
animate
())
);
}
void
MyQT
::
cb_redraw
()
void
Tuto5
::
cb_redraw
()
{
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glEnable
(
GL_LIGHTING
);
...
...
@@ -213,9 +173,9 @@ void MyQT::cb_redraw()
if
(
render_topo
)
m_render_topo
->
drawTopo
();
Dart
d
=
m
yMap
.
phi2
(
m
yMap
.
begin
());
Dart
d
=
m
.
phi2
(
m
.
begin
());
m_render_topo
->
overdrawDart
(
d
,
5
,
1.0
f
,
0.0
f
,
1.0
f
);
d
=
m
yMap
.
phi1
(
m
yMap
.
begin
());
d
=
m
.
phi1
(
m
.
begin
());
m_render_topo
->
overdrawDart
(
d
,
5
,
1.0
f
,
0.0
f
,
1.0
f
);
glDisable
(
GL_POLYGON_OFFSET_FILL
);
...
...
@@ -237,11 +197,11 @@ void MyQT::cb_redraw()
}
}
void
MyQT
::
cb_mousePress
(
int
button
,
int
x
,
int
y
)
void
Tuto5
::
cb_mousePress
(
int
button
,
int
x
,
int
y
)
{
if
(
Shift
())
{
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
m
yMap
,
allDarts
,
x
,
y
);
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
m
,
allDarts
,
x
,
y
);
if
(
d
!=
Dart
::
nil
())
{
CGoGNout
<<
"Dart "
<<
d
<<
" clicked"
<<
CGoGNendl
;
...
...
@@ -253,16 +213,16 @@ void MyQT::cb_mousePress(int button, int x, int y)
}
}
void
MyQT
::
cb_keyPress
(
int
code
)
void
Tuto5
::
cb_keyPress
(
int
code
)
{
if
(
code
==
's'
)
{
std
::
string
filename
=
selectFileSave
(
"Export SVG file "
);
CGoGNout
<<
"Exporting "
<<
filename
<<
CGoGNendl
;
Algo
::
Render
::
SVG
::
SVGOut
svg
(
filename
,
modelViewMatrix
(),
projectionMatrix
());
// svg.renderLinesToSVG<PFP>(m
yMap
,position);
// svg.renderLinesToSVG<PFP>(m,position);
svg
.
setColor
(
Geom
::
Vec3f
(
1.
,
0.
,
0.
));
svg
.
renderFacesToSVG
<
PFP
>
(
m
yMap
,
position
,
0.8
f
);
svg
.
renderFacesToSVG
<
PFP
>
(
m
,
position
,
0.8
f
);
//svg destruction close the file
}
if
(
code
==
't'
)
...
...
@@ -274,129 +234,296 @@ void MyQT::cb_keyPress(int code)
}
}
Dart
embedCube
()
Dart
Tuto5
::
embedCube
()
{
Dart
d
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
yMap
,
6
);
Dart
d
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
6
);
m
yMap
.
closeMap
();
m
.
closeMap
();
Dart
dres
=
d
;
position
[
d
]
=
PFP
::
VEC3
(
0
,
0
,
0
);
position
[
m
yMap
.
phi1
(
d
)]
=
PFP
::
VEC3
(
1
,
0
,
0
);
position
[
m
yMap
.
phi1
(
m
yMap
.
phi1
(
d
))]
=
PFP
::
VEC3
(
1
,
0
,
1
);
position
[
m
yMap
.
phi_1
(
d
)]
=
PFP
::
VEC3
(
0
,
0
,
1
);
d
=
m
yMap
.
phi_1
(
m
yMap
.
phi2
(
m
yMap
.
phi_1
(
m
yMap
.
phi_1
(
m
yMap
.
phi2
(
m
yMap
.
phi_1
(
d
))))));
position
[
m
.
phi1
(
d
)]
=
PFP
::
VEC3
(
1
,
0
,
0
);
position
[
m
.
phi1
(
m
.
phi1
(
d
))]
=
PFP
::
VEC3
(
1
,
0
,
1
);
position
[
m
.
phi_1
(
d
)]
=
PFP
::
VEC3
(
0
,
0
,
1
);
d
=
m
.
phi_1
(
m
.
phi2
(
m
.
phi_1
(
m
.
phi_1
(
m
.
phi2
(
m
.
phi_1
(
d
))))));
position
[
d
]
=
PFP
::
VEC3
(
1
,
1
,
0
);
position
[
m
yMap
.
phi1
(
d
)]
=
PFP
::
VEC3
(
0
,
1
,
0
);
position
[
m
yMap
.
phi1
(
m
yMap
.
phi1
(
d
))]
=
PFP
::
VEC3
(
0
,
1
,
1
);
position
[
m
yMap
.
phi_1
(
d
)]
=
PFP
::
VEC3
(
1
,
1
,
1
);
position
[
m
.
phi1
(
d
)]
=
PFP
::
VEC3
(
0
,
1
,
0
);
position
[
m
.
phi1
(
m
.
phi1
(
d
))]
=
PFP
::
VEC3
(
0
,
1
,
1
);
position
[
m
.
phi_1
(
d
)]
=
PFP
::
VEC3
(
1
,
1
,
1
);
return
m
yMap
.
phi2
(
m
yMap
.
phi1
(
dres
));
return
m
.
phi2
(
m
.
phi1
(
dres
));
}
Dart
embedCube2
()
Dart
Tuto5
::
embedCube2
()
{
Dart
d
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
yMap
,
6
);
Dart
d
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
6
);
m
yMap
.
closeMap
();
m
.
closeMap
();
Dart
dres
=
d
;
position
[
d
]
=
PFP
::
VEC3
(
2
,
0
,
0
);
position
[
m
yMap
.
phi1
(
d
)]
=
PFP
::
VEC3
(
3
,
0
,
0
);
position
[
m
yMap
.
phi1
(
m
yMap
.
phi1
(
d
))]
=
PFP
::
VEC3
(
3
,
0
,
1
);
position
[
m
yMap
.
phi_1
(
d
)]
=
PFP
::
VEC3
(
2
,
0
,
1
);
d
=
m
yMap
.
phi_1
(
m
yMap
.
phi2
(
m
yMap
.
phi_1
(
m
yMap
.
phi_1
(
m
yMap
.
phi2
(
m
yMap
.
phi_1
(
d
))))));
position
[
m
.
phi1
(
d
)]
=
PFP
::
VEC3
(
3
,
0
,
0
);
position
[
m
.
phi1
(
m
.
phi1
(
d
))]
=
PFP
::
VEC3
(
3
,
0
,
1
);
position
[
m
.
phi_1
(
d
)]
=
PFP
::
VEC3
(
2
,
0
,
1
);
d
=
m
.
phi_1
(
m
.
phi2
(
m
.
phi_1
(
m
.
phi_1
(
m
.
phi2
(
m
.
phi_1
(
d
))))));
position
[
d
]
=
PFP
::
VEC3
(
3
,
1
,
0
);
position
[
myMap
.
phi1
(
d
)]
=
PFP
::
VEC3
(
2
,
1
,
0
);
position
[
myMap
.
phi1
(
myMap
.
phi1
(
d
))]
=
PFP
::
VEC3
(
2
,
1
,
1
);
position
[
myMap
.
phi_1
(
d
)]
=
PFP
::
VEC3
(
3
,
1
,
1
);
position
[
m
.
phi1
(
d
)]
=
PFP
::
VEC3
(
2
,
1
,
0
);
position
[
m
.
phi1
(
m
.
phi1
(
d
))]
=
PFP
::
VEC3
(
2
,
1
,
1
);
position
[
m
.
phi_1
(
d
)]
=
PFP
::
VEC3
(
3
,
1
,
1
);
return
m
.
phi2
(
m
.
phi_1
(
dres
));
}
Dart
Tuto5
::
embedMapCollapse
()
{
return
myMap
.
phi2
(
myMap
.
phi_1
(
dres
));
Dart
dd
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
Dart
t1
=
dd
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
0.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
-
2.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.
f
,
-
1.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
dd
));
position
[
t1
]
=
PFP
::
VEC3
(
-
0.5
f
,
-
1.
f
,
0.
f
);
Dart
ee
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
dd
,
ee
);
t1
=
ee
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
-
2.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
0.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.
f
,
-
1.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
ee
));
position
[
t1
]
=
PFP
::
VEC3
(
1.
f
,
-
1.
f
,
0.
f
);
Dart
ff
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
m
.
phi2
(
dd
),
ff
);
t1
=
ff
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
0.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
-
2.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
-
0.5
f
,
-
1.
f
,
0.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
ff
));
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.
f
,
1.
f
);
Dart
gg
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
gg
,
m
.
phi2
(
ee
));
m
.
sewVolumes
(
m
.
phi2
(
gg
),
m
.
phi2
(
ff
));
t1
=
gg
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
-
2.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
0.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
1.
f
,
-
1.
f
,
0.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
gg
));
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.
f
,
1.
f
);
Dart
hh
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
m
.
phi2
(
m
.
phi_1
(
dd
)),
hh
);
t1
=
hh
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
-
1.0
f
,
-
1.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
0.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
-
0.5
f
,
-
1.
f
,
0.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
hh
));
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
0.2
f
,
-
0.8
f
);
Dart
jj
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
jj
,
m
.
phi
<
12
>
(
ee
));
t1
=
jj
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
0.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
-
1.0
f
,
-
1.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
1.
f
,
-
1.
f
,
0.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
jj
));
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
0.2
f
,
-
0.8
f
);
Dart
kk
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
kk
,
m
.
phi
<
12
>
(
dd
));
t1
=
kk
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
-
2.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
-
1.0
f
,
-
1.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
-
0.5
f
,
-
1.
f
,
0.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
kk
));
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.8
f
,
-
0.6
f
);
Dart
ll
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
ll
,
m
.
phi2
(
m
.
phi_1
(
ee
)));
t1
=
ll
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
-
1.0
f
,
-
1.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
-
2.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
1.
f
,
-
1.
f
,
0.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
ll
));
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.8
f
,
-
0.6
f
);
/*4 tetra du pourtout de devant */
Dart
mm
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
mm
,
m
.
phi2
(
m
.
phi_1
(
ff
)));
t1
=
mm
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
-
0.5
f
,
-
1.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.0
f
,
0.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.
f
,
1.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
mm
));
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
0.2
f
,
0.8
f
);
Dart
ww
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
ww
,
m
.
phi
<
12
>
(
gg
));
t1
=
ww
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
0.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
1.0
f
,
-
1.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.
f
,
1.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
ww
));
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
0.2
f
,
0.8
f
);
Dart
xx
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
xx
,
m
.
phi
<
12
>
(
ff
));
t1
=
xx
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
2.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
-
0.5
f
,
-
1.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.
f
,
1.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
xx
));
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.6
f
,
0.6
f
);
Dart
cc
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createPolyhedron
(
m
,
4
);
m
.
closeMap
();
m
.
sewVolumes
(
cc
,
m
.
phi2
(
m
.
phi_1
(
gg
)));
t1
=
cc
;
// plongement
position
[
t1
]
=
PFP
::
VEC3
(
1.
f
,
-
1.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
2.0
f
,
0.0
f
);
t1
=
m
.
phi1
(
t1
);
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.
f
,
1.
f
);
t1
=
m
.
phi_1
(
m
.
phi2
(
cc
));
position
[
t1
]
=
PFP
::
VEC3
(
0.
f
,
-
1.6
f
,
0.6
f
);
return
dd
;
}
int
main
(
int
argc
,
char
**
argv
)
{
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
Dart
d1
=
embedCube
()
;
Dart
d2
=
embedCube2
()
;
// un peu d'interface
QApplication
app
(
argc
,
argv
)
;
Tuto5
sqt
;
Dart
dd
=
myMap
.
phi2
(
d1
)
;
myMap
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
sqt
.
position
=
sqt
.
m
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
myMap
.
sewVolumes
(
d1
,
d2
);
Dart
d1
=
sqt
.
embedMapCollapse
(
);
myMap
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
sqt
.
m
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
sqt
.
m
.
getNbDarts
()
<<
std
::
endl
;
myMap
.
mergeVolumes
(
d1
)
;
myMap
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
sqt
.
m
.
collapseEdge
(
d1
);
sqt
.
m
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
sqt
.
m
.
getNbDarts
()
<<
std
::
endl
;
std
::
vector
<
Dart
>
v
;
v
.
push_back
(
dd
)
;
dd
=
myMap
.
phi1
(
myMap
.
phi2
(
myMap
.
phi1
(
dd
)))
;
v
.
push_back
(
dd
)
;
dd
=
myMap
.
phi1
(
myMap
.
phi2
(
myMap
.
phi1
(
dd
)))
;
v
.
push_back
(
dd
)
;
dd
=
myMap
.
phi1
(
myMap
.
phi2
(
myMap
.
phi1
(
dd
)))
;
v
.
push_back
(
dd
)
;
// Dart d1 = sqt.embedCube() ;
// Dart d2 = sqt.embedCube2() ;
//
// Dart dd = sqt.m.phi2(d1) ;
myMap
.
splitVolume
(
v
)
;
// sqt.m.check() ;
// std::cout << "nb darts -> " << sqt.m.getNbDarts() << std::endl ;
myMap
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
// sqt.m.sewVolumes(d1, d2);
Dart
f
=
myMap
.
phi2
(
v
.
front
())
;
Dart
f3
=
myMap
.
phi3
(
f
)
;
myMap
.
unsewVolumes
(
f
)
;
// sqt.m.check() ;
// std::cout << "nb darts -> " << sqt.m.getNbDarts() << std::endl ;
myMap
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
// sqt.m.mergeVolumes(d1) ;
myMap
.
sewVolumes
(
f
,
f3
)
;
// sqt.m.check() ;
// std::cout << "nb darts -> " << sqt.m.getNbDarts() << std::endl ;
myMap
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
// std::vector<Dart> v ;
// v.push_back(dd) ;
// dd = sqt.m.phi1(sqt.m.phi2(sqt.m.phi1(dd))) ;
// v.push_back(dd) ;
// dd = sqt.m.phi1(sqt.m.phi2(sqt.m.phi1(dd))) ;
// v.push_back(dd) ;
// dd = sqt.m.phi1(sqt.m.phi2(sqt.m.phi1(dd))) ;
// v.push_back(dd) ;
//
// sqt.m.splitVolume(v) ;
myMap
.
splitFace
(
f
,
myMap
.
phi1
(
myMap
.
phi1
(
f
)))
;
// sqt.m.check() ;
// std::cout << "nb darts -> " << sqt.m.getNbDarts() << std::endl ;
myMap
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
// Dart f = sqt.m.phi2(v.front()) ;
// Dart f3 = sqt.m.phi3(f) ;
// sqt.m.unsewVolumes(f) ;
PFP
::
VEC3
p
=
position
[
f
]
+
position
[
myMap
.
phi_1
(
f
)]
;
p
/=
2.0
;
myMap
.
cutEdge
(
myMap
.
phi_1
(
f
))
;
position
[
myMap
.
phi_1
(
f
)]
=
p
;
// sqt.m.check() ;
// std::cout << "nb darts -> " << sqt.m.getNbDarts() << std::endl ;
myMap
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
// sqt.m.sewVolumes(f, f3) ;
myMap
.
uncutEdge
(
myMap
.
phi_1
(
myMap
.
phi_1
(
f
)))
;
// sqt.m.check() ;
// std::cout << "nb darts -> " << sqt.m.getNbDarts() << std::endl ;
myMap
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
// sqt.m.splitFace(f, sqt.m.phi1(sqt.m.phi1(f))) ;
myMap
.
deleteVolume
(
f
)
;
// sqt.m.check() ;
// std::cout << "nb darts -> " << sqt.m.getNbDarts() << std::endl ;
myMap
.
check
()
;
std
::
cout
<<
"nb darts -> "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
// PFP::VEC3 p = sqt.position[f] + sqt.position[sqt.m.phi_1(f)] ;
// p /= 2.0 ;
// sqt.m.cutEdge(sqt.m.phi_1(f)) ;
// sqt.position[sqt.m.phi_1(f)] = p ;
// Algo::Modelisation::Primitive3D<PFP> prim(myMap, position);
//
// int nb=3;
// if (argc>1)
// nb = atoi(argv[1]);
// dglobal = prim.hexaGrid_topo(nb,nb,nb);
// prim.embedHexaGrid(1.0f,1.0f,1.0f);
//
// myMap.closeMap();
// sqt.m.check() ;
// std::cout << "nb darts -> " << sqt.m.getNbDarts() << std::endl ;
// sqt.m.uncutEdge(sqt.m.phi_1(sqt.m.phi_1(f))) ;
// sqt.m.check() ;
// std::cout << "nb darts -> " << sqt.m.getNbDarts() << std::endl ;
// sqt.m.deleteVolume(f) ;
// sqt.m.check() ;
// std::cout << "nb darts -> " << sqt.m.getNbDarts() << std::endl ;
// un peu d'interface
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
// interface de tuto5.ui
Utils
::
QT
::
uiDockInterface
dock
;
...
...
@@ -405,17 +532,8 @@ int main(int argc, char **argv)
// message d'aide
sqt
.
setHelpMsg
(
"Enter pour dock on/off
\n
Shift Enter pour console on/off
\n
Shift Click gauche pour selectionner un brin"
);
CGoGNout
.
toStatusBar
(
&
sqt
);
CGoGNout
<<
"CGoGNOut StatusBar"
<<
Geom
::
Vec3f
(
2.5
f
,
2.2
f
,
4.3
f
)
<<
CGoGNendl
;
CGoGNout
.
toConsole
(
&
sqt
);
CGoGNout
<<
"CGoGNOut dans la console"
<<
Geom
::
Vec3f
(
2.5
f
,
2.2
f
,
4.3
f
)
<<
CGoGNendl
;
CGoGNout
.
toStatusBar
(
NULL
);
// bounding box
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
sqt
.
m
,
sqt
.
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
);
...
...
@@ -437,14 +555,6 @@ int main(int argc, char **argv)
sqt
.
slider_vectors
(
50
);
sqt
.
slider_text
(
50
);
GLint
texSize
;
glGetIntegerv
(
GL_MAX_TEXTURE_SIZE
,
&
texSize
);
CGoGNdbg
.
toConsole
(
&
sqt
);
CGoGNerr
.
toConsole
(
&
sqt
);