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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
492e71b3
Commit
492e71b3
authored
Jan 08, 2014
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding volume Regular tilings
Cubic tiling ok
parent
0bd11b96
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1309 additions
and
294 deletions
+1309
-294
Apps/Examples/clipping.cpp
Apps/Examples/clipping.cpp
+4
-4
Apps/Examples/clipping.h
Apps/Examples/clipping.h
+1
-1
Apps/Examples/simpleGMap3.cpp
Apps/Examples/simpleGMap3.cpp
+11
-12
Apps/Examples/simpleMap3.cpp
Apps/Examples/simpleMap3.cpp
+17
-18
Apps/Examples/volumeExplorer.cpp
Apps/Examples/volumeExplorer.cpp
+4
-4
Apps/SandBox/CMakeLists.txt
Apps/SandBox/CMakeLists.txt
+2
-1
Apps/SandBox/tilings.cpp
Apps/SandBox/tilings.cpp
+177
-82
Apps/Tuto/show_traversors.cpp
Apps/Tuto/show_traversors.cpp
+4
-4
Apps/Tuto/tuto3.cpp
Apps/Tuto/tuto3.cpp
+64
-64
Apps/Tuto/tuto5.cpp
Apps/Tuto/tuto5.cpp
+4
-4
Apps/Tuto/tuto_oper3.cpp
Apps/Tuto/tuto_oper3.cpp
+3
-10
Apps/Tuto/tuto_orbits.cpp
Apps/Tuto/tuto_orbits.cpp
+4
-5
include/Algo/Import/import2tablesVolume.hpp
include/Algo/Import/import2tablesVolume.hpp
+9
-8
include/Algo/Tiling/Surface/hexagonal.h
include/Algo/Tiling/Surface/hexagonal.h
+124
-0
include/Algo/Tiling/Surface/hexagonal.hpp
include/Algo/Tiling/Surface/hexagonal.hpp
+123
-0
include/Algo/Tiling/Surface/square.h
include/Algo/Tiling/Surface/square.h
+24
-12
include/Algo/Tiling/Surface/square.hpp
include/Algo/Tiling/Surface/square.hpp
+45
-28
include/Algo/Tiling/Surface/triangular.h
include/Algo/Tiling/Surface/triangular.h
+51
-37
include/Algo/Tiling/Surface/triangular.hpp
include/Algo/Tiling/Surface/triangular.hpp
+123
-0
include/Algo/Tiling/Volume/cubic.h
include/Algo/Tiling/Volume/cubic.h
+136
-0
include/Algo/Tiling/Volume/cubic.hpp
include/Algo/Tiling/Volume/cubic.hpp
+247
-0
include/Algo/Tiling/tiling.h
include/Algo/Tiling/tiling.h
+16
-0
include/Algo/Tiling/tiling.hpp
include/Algo/Tiling/tiling.hpp
+116
-0
No files found.
Apps/Examples/clipping.cpp
View file @
492e71b3
...
...
@@ -1114,10 +1114,10 @@ int main(int argc, char** argv)
}
else
{
sqt
.
position
=
sqt
.
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
sqt
.
myMap
,
sqt
.
position
);
prim
.
hexaGrid_topo
(
10
,
10
,
10
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
);
sqt
.
position
=
sqt
.
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
sqt
.
myMap
,
10
,
10
,
10
);
cubic
.
embedIntoGrid
(
sqt
.
position
,
1.0
f
,
1.0
f
,
1.0
f
);
}
sqt
.
initGUI
();
...
...
Apps/Examples/clipping.h
View file @
492e71b3
...
...
@@ -57,7 +57,7 @@
#include "Utils/cgognStream.h"
#include "Utils/drawer.h"
#include "Algo/
Modelisation/primitives3d
.h"
#include "Algo/
Tiling/Volume/cubic
.h"
#include <string>
#include <sstream>
...
...
Apps/Examples/simpleGMap3.cpp
View file @
492e71b3
...
...
@@ -25,7 +25,7 @@
#include "simpleGMap3.h"
#include "Utils/GLSLShader.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/
Modelisation/primitives3d
.h"
#include "Algo/
Tiling/Volume/cubic
.h"
#include "Algo/Modelisation/subdivision3.h"
SimpleGMap3
::
SimpleGMap3
()
...
...
@@ -35,22 +35,21 @@ SimpleGMap3::SimpleGMap3()
// CellMarker<EDGE> mE(myMap);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
1
,
1
,
1
);
primCat
.
embedHexaGrid
(
1
,
1
,
1
);
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
myMap
,
1
,
1
,
1
);
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
1.0
f
);
myMap
.
check
();
Dart
dp
=
Algo
::
Surface
::
Modelisation
::
createQuadrangularPyramid
<
PFP
>
(
myMap
);
//
Dart dp = Algo::Surface::Modelisation::createQuadrangularPyramid<PFP>(myMap);
position
[
dp
]
=
typename
PFP
::
VEC3
(
0.5
,
0.5
,
-
0.5
);
position
[
myMap
.
phi1
(
dp
)]
=
typename
PFP
::
VEC3
(
0.5
,
0.5
,
0.5
);
position
[
myMap
.
phi1
(
myMap
.
phi1
(
dp
))]
=
typename
PFP
::
VEC3
(
0.5
,
-
0.5
,
0.5
);
position
[
myMap
.
phi_1
(
dp
)]
=
typename
PFP
::
VEC3
(
0.5
,
-
0.5
,
-
0.5
);
position
[
myMap
.
phi_1
(
myMap
.
phi2
(
dp
))]
=
typename
PFP
::
VEC3
(
1.5
f
,
0.0
f
,
0.0
f
);
//
position[dp] = typename PFP::VEC3(0.5,0.5,-0.5);
//
position[myMap.phi1(dp)] = typename PFP::VEC3(0.5,0.5,0.5);
//
position[myMap.phi1(myMap.phi1(dp))] = typename PFP::VEC3(0.5,-0.5,0.5);
//
position[myMap.phi_1(dp)] = typename PFP::VEC3(0.5,-0.5,-0.5);
//
position[myMap.phi_1(myMap.phi2(dp))] = typename PFP::VEC3(1.5f, 0.0f, 0.0f);
Dart
dtemp
=
myMap
.
beta1
(
myMap
.
beta0
(
myMap
.
beta1
(
myMap
.
beta2
(
myMap
.
beta1
(
myMap
.
beta0
(
myMap
.
beta1
(
myMap
.
beta2
(
d
))))))));
//
Dart dtemp = myMap.beta1(myMap.beta0(myMap.beta1(myMap.beta2(myMap.beta1(myMap.beta0(myMap.beta1(myMap.beta2(d))))))));
myMap
.
sewVolumes
(
dtemp
,
dp
);
//
myMap.sewVolumes(dtemp,dp);
// Geom::Plane3D<PFP::REAL> pl(VEC3(-1,-0.5,-0.5),VEC3(-1,-0.5,0.5),VEC3(1,0.5,0.5));
// Algo::Volume::Modelisation::sliceConvexVolume<PFP>(myMap, position, d, pl);
...
...
Apps/Examples/simpleMap3.cpp
View file @
492e71b3
...
...
@@ -25,35 +25,34 @@
#include "simpleMap3.h"
#include "Utils/GLSLShader.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/
Modelisation/primitives3d
.h"
#include "Algo/
Tiling/Volume/cubic
.h"
#include "Algo/Modelisation/subdivision3.h"
SimpleMap3
::
SimpleMap3
()
{
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
1
,
1
,
1
);
primCat
.
embedHexaGrid
(
1
,
1
,
1
);
myMap
.
closeMap
();
myMap
.
check
();
Dart
dp
=
Algo
::
Surface
::
Modelisation
::
createQuadrangularPyramid
<
PFP
>
(
myMap
);
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
myMap
,
1
,
1
,
1
);
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
1.0
f
);
myMap
.
check
();
position
[
dp
]
=
typename
PFP
::
VEC3
(
0.5
,
0.5
,
-
0.5
);
position
[
myMap
.
phi1
(
dp
)]
=
typename
PFP
::
VEC3
(
0.5
,
0.5
,
0.5
);
position
[
myMap
.
phi1
(
myMap
.
phi1
(
dp
))]
=
typename
PFP
::
VEC3
(
0.5
,
-
0.5
,
0.5
);
position
[
myMap
.
phi_1
(
dp
)]
=
typename
PFP
::
VEC3
(
0.5
,
-
0.5
,
-
0.5
);
position
[
myMap
.
phi_1
(
myMap
.
phi2
(
dp
))]
=
typename
PFP
::
VEC3
(
1.5
f
,
0.0
f
,
0.0
f
);
Dart
dtemp
=
myMap
.
phi_1
(
myMap
.
phi2
(
myMap
.
phi_1
(
myMap
.
phi_1
(
myMap
.
phi2
(
d
))))
);
// Dart dp = Algo::Surface::Modelisation::createQuadrangularPyramid<PFP>(myMap
);
myMap
.
sewVolumes
(
dtemp
,
dp
);
// position[dp] = typename PFP::VEC3(0.5,0.5,-0.5);
// position[myMap.phi1(dp)] = typename PFP::VEC3(0.5,0.5,0.5);
// position[myMap.phi1(myMap.phi1(dp))] = typename PFP::VEC3(0.5,-0.5,0.5);
// position[myMap.phi_1(dp)] = typename PFP::VEC3(0.5,-0.5,-0.5);
// position[myMap.phi_1(myMap.phi2(dp))] = typename PFP::VEC3(1.5f, 0.0f, 0.0f);
// Algo::Volume::Modelisation::Primitive3D<PFP> primCat(myMap, position);
// Dart d = primCat.hexaGrid_topo(2,1,1);
// primCat.embedHexaGrid(1,1,1);
// myMap.closeMap();
// Dart dtemp = myMap.phi_1(myMap.phi2(myMap.phi_1(myMap.phi_1(myMap.phi2(d)))));
// myMap.sewVolumes(dtemp,dp);
// Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, 2, 1, 1);
// cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
// myMap.check();
// unsigned int nb=0;
// for(unsigned int i = position.begin(); i!=position.end(); position.next(i))
...
...
Apps/Examples/volumeExplorer.cpp
View file @
492e71b3
...
...
@@ -26,7 +26,7 @@
#include "volumeExplorer.h"
#include <iostream>
#include "Algo/
Modelisation/primitives3d
.h"
#include "Algo/
Tiling/Volume/cubic
.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Import/import.h"
#include "Algo/Geometry/volume.h"
...
...
@@ -440,10 +440,10 @@ int main(int argc, char **argv)
else
{
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
int
nb
=
8
;
prim
.
hexaGrid_topo
(
nb
,
nb
,
nb
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
);
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
myMap
,
nb
,
nb
,
nb
);
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
1.0
f
);
for
(
unsigned
int
i
=
position
.
begin
();
i
!=
position
.
end
();
position
.
next
(
i
))
{
...
...
Apps/SandBox/CMakeLists.txt
View file @
492e71b3
...
...
@@ -26,7 +26,8 @@ ENDIF(WIN32)
add_executable
(
multi_att multi_att.cpp
)
target_link_libraries
(
multi_att
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
add_executable
(
tilings tilings.cpp
)
QT4_WRAP_CPP
(
tilings_moc tilings.h
)
add_executable
(
tilings tilings.cpp
${
tilings_moc
}
)
target_link_libraries
(
tilings
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
# Example with Qt
...
...
Apps/SandBox/tilings.cpp
View file @
492e71b3
...
...
@@ -22,19 +22,19 @@
* *
*******************************************************************************/
#include <iostream>
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "tilings.h"
#include "Geometry/vector_gen.h"
#include "Algo/Export/export.h"
#include "Algo/Import/import.h"
#include "Algo/Geometry/boundingbox.h"
#include "Utils/GLSLShader.h"
//#include "Algo/Geometry/area.h"
#include "Algo/Geometry/normal.h"
#include "Algo/Tiling/square.h"
//#include "Algo/Tiling/triangular.h"
//#include "Algo/Tiling/hexagonal.h"
#include "Utils/cgognStream.h"
#include "Utils/chrono.h"
using
namespace
CGoGN
;
...
...
@@ -48,91 +48,186 @@ struct PFP: public PFP_STANDARD
typedef
EmbeddedMap2
MAP
;
};
int
main
(
int
argc
,
char
**
argv
)
PFP
::
MAP
myMap
;
VertexAttribute
<
PFP
::
VEC3
>
position
;
VertexAttribute
<
PFP
::
VEC3
>
position2
;
VertexAttribute
<
PFP
::
VEC3
>
normal
;
void
MyQT
::
cb_initGL
()
{
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
);
// create the render
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
();
// create VBO for position
m_positionVBO
=
new
Utils
::
VBO
();
m_positionVBO
->
updateData
(
position
);
m_normalVBO
=
new
Utils
::
VBO
();
m_shader
=
new
Utils
::
ShaderSimpleColor
();
m_shader
->
setAttributePosition
(
m_positionVBO
);
m_shader
->
setColor
(
Geom
::
Vec4f
(
1.
,
1.
,
0.
,
0.
));
m_lines
=
new
Utils
::
ShaderVectorPerVertex
();
m_lines
->
setAttributePosition
(
m_positionVBO
);
m_lines
->
setAttributeVector
(
m_normalVBO
);
m_lines
->
setScale
(
0.2
f
);
m_lines
->
setColor
(
Geom
::
Vec4f
(
0.0
f
,
1.0
f
,
0.2
f
,
0.0
f
));
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
LINES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
POINTS
);
registerShader
(
m_shader
);
registerShader
(
m_lines
);
m_normalVBO
->
updateData
(
normal
);
}
void
MyQT
::
cb_redraw
()
{
m_render
->
draw
(
m_shader
,
Algo
::
Render
::
GL2
::
LINES
);
m_render
->
draw
(
m_lines
,
Algo
::
Render
::
GL2
::
POINTS
);
}
// mouse picking
void
MyQT
::
tiling
(
int
code
)
{
if
(
argc
!=
2
)
//myMap.clear(false);
switch
(
code
)
{
case
1
:
{
std
::
cout
<<
"square grid tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
10
,
10
,
true
);
g
.
embedIntoGrid
(
position
,
50
,
50
);
break
;
}
case
2
:
{
std
::
cout
<<
"square grid twisted strip tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
10
,
10
,
true
);
g
.
embedIntoTwistedStrip
(
position
,
0.3
,
0.8
,
5
);
break
;
}
case
3
:
{
std
::
cout
<<
"square grid helocoid tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
20
,
20
,
true
);
g
.
embedIntoHelicoid
(
position
,
0.3
,
0.8
,
5.0
,
2.0
);
break
;
}
case
4
:
{
std
::
cout
<<
"square cylinder tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
5.0
);
break
;
}
case
5
:
{
std
::
cout
<<
"square cylinder tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleBottom
();
c
.
triangleTop
();
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
5.0
);
break
;
}
case
6
:
{
std
::
cout
<<
"square cylinder sphere tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleTop
();
c
.
triangleBottom
();
c
.
embedIntoSphere
(
position
,
0.5
);
break
;
}
case
7
:
{
std
::
cout
<<
"square cylinder cone tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
triangleTop
();
c
.
triangleBottom
();
c
.
embedIntoCone
(
position
,
0.5
,
5.0
);
break
;
}
case
8
:
{
std
::
cout
<<
"square cylinder cone tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cube
<
PFP
>
c
(
myMap
,
20
,
20
,
20
);
c
.
embedIntoCube
(
position
,
5.0
,
5.0
,
5.0
);
break
;
}
case
9
:
{
CGoGNout
<<
"Usage : "
<<
argv
[
0
]
<<
" tiling-type"
<<
CGoGNendl
;
return
0
;
std
::
cout
<<
"square cylinder cone tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Tore
<
PFP
>
c
(
myMap
,
20
,
10
);
c
.
embedIntoTore
(
position
,
5.0
,
2.0
);
break
;
}
unsigned
int
tiling
;
std
::
istringstream
iss
(
argv
[
1
]);
iss
>>
tiling
;
default:
{
break
;
}
}
// declaration of the map
PFP
::
MAP
myMap
;
// m_positionVBO->updateData(position);
// m_lines->setAttributePosition(m_positionVBO);
// updateGL();
}
VertexAttribute
<
PFP
::
VEC3
>
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
int
main
(
int
argc
,
char
**
argv
)
{
// interface:
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
sqt
.
statusMsg
(
"Neww to create a sphere or Load for a mesh file"
);
CGoGNStream
::
allToConsole
(
&
sqt
);
if
(
!
position
.
isValid
())
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
switch
(
tiling
)
if
(
!
normal
.
isValid
())
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"normal"
);
if
(
argc
==
2
)
{
case
1
:
{
std
::
cout
<<
"square grid tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
10
,
10
,
true
);
g
.
embedIntoGrid
(
position
,
50
,
50
);
Algo
::
Surface
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
"square_grid.off"
);
break
;
}
case
2
:
{
std
::
cout
<<
"square grid twisted strip tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
10
,
10
,
true
);
g
.
embedIntoTwistedStrip
(
position
,
0.3
,
0.8
,
5
);
Algo
::
Surface
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
"square_grid_strip.off"
);
break
;
}
case
3
:
{
std
::
cout
<<
"square grid helocoid tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Grid
<
PFP
>
g
(
myMap
,
20
,
20
,
true
);
g
.
embedIntoHelicoid
(
position
,
0.3
,
0.8
,
5.0
,
2.0
);
Algo
::
Surface
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
"square_grid_helicoid.off"
);
break
;
}
case
4
:
{
std
::
cout
<<
"square cylinder tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
closeTop
();
c
.
closeBottom
();
//c.triangleTop();
//c.triangleBottom();
c
.
embedIntoCylinder
(
position
,
0.5
,
0.7
,
5.0
);
Algo
::
Surface
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
"square_cylinder.off"
);
break
;
}
case
5
:
{
std
::
cout
<<
"square cylinder sphere tiling"
<<
std
::
endl
;
Algo
::
Surface
::
Tilings
::
Square
::
Cylinder
<
PFP
>
c
(
myMap
,
20
,
20
);
c
.
closeTop
();
c
.
closeBottom
();
c
.
triangleTop
();
c
.
triangleBottom
();
c
.
embedIntoSphere
(
position
,
0.5
);
Algo
::
Surface
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
"square_cylinder_sphere.off"
);
break
;
}
default:
{
break
;
}
sqt
.
tiling
(
atoi
(
argv
[
1
]));
}
return
0
;
// bounding box
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
);
CGoGNout
<<
"lPosObj="
<<
lPosObj
<<
CGoGNendl
;
CGoGNout
<<
"lWidthObj="
<<
lWidthObj
<<
CGoGNendl
;
sqt
.
setParamObject
(
lWidthObj
,
lPosObj
.
data
());
// myMap.enableQuickTraversal<EDGE>() ;
// myMap.enableQuickTraversal<VERTEX>() ;
sqt
.
show
();
return
app
.
exec
();
}
Apps/Tuto/show_traversors.cpp
View file @
492e71b3
...
...
@@ -25,7 +25,7 @@
#include "show_traversors.h"
#include <iostream>
#include "Algo/
Modelisation/primitives3d
.h"
#include "Algo/
Tiling/Volume/cubic
.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/subdivision.h"
...
...
@@ -613,9 +613,9 @@ int main(int argc, char **argv)
{
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
dglobal
=
prim
.
hexaGrid_topo
(
3
,
3
,
3
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
)
;
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
myMap
,
3
,
3
,
3
);
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
1.0
f
);
dglobal
=
NIL
;
}
else
{
...
...
Apps/Tuto/tuto3.cpp
View file @
492e71b3
...
...
@@ -32,27 +32,27 @@ 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
);
// // interface
QApplication
app
(
argc
,
argv
);
MyQT
sqt
;
// copy output tout Qt console of application (shift enter)
CGoGNout
.
toConsole
(
&
sqt
);
// example code itself
sqt
.
createMap
();
// example code itself
sqt
.
createMap
();
sqt
.
traverseMap
();
sqt
.
traverseMap
();
// set help message in menu
sqt
.
setHelpMsg
(
"Tuto 3:
\n
Usage of DartMarker and CellMarker
\n
Pick of dart with mouse"
);
// final show for redraw
sqt
.
show
();
// set help message in menu
sqt
.
setHelpMsg
(
"Tuto 3:
\n
Usage of DartMarker and CellMarker
\n
Pick of dart with mouse"
);
// final show for redraw
sqt
.
show
();
CGoGNout
<<
"You can pick darts dans see it's id with left mouse button"
<<
CGoGNendl
;
CGoGNout
<<
"You can pick darts dans see it's id with left mouse button"
<<
CGoGNendl
;
// and wait for the end
return
app
.
exec
();
// and wait for the end
return
app
.
exec
();
}
Dart
xd1
;
...
...
@@ -60,29 +60,29 @@ Dart xd1;
void
MyQT
::
traverseMap
()
{
DartMarker
m1
(
myMap
);
DartMarker
m2
(
myMap
);
myMap
.
rdfi
(
myMap
.
begin
(),
m1
,
m2
);
DartMarker
m1
(
myMap
);
DartMarker
m2
(
myMap
);
myMap
.
rdfi
(
myMap
.
begin
(),
m1
,
m2
);
m1
.
unmarkAll
();
m1
.
unmarkAll
();
m1
.
markOrbit
<
VOLUME
>
(
xd1
);
m1
.
markOrbit
<
VOLUME
>
(
xd1
);
// render the topo of the map without boundary darts
// render the topo of the map without boundary darts
// SelectorDartNoBoundary<PFP::MAP> nb(myMap);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
);
// nb
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
if
(
m2
.
isMarked
(
d
))
{
m_render_topo
->
setDartColor
(
d
,
1.0
f
,
0.0
f
,
0.0
f
);
}
if
(
m1
.
isMarked
(
d
))
{
m_render_topo
->
setDartColor
(
d
,
0.0
f
,
1.0
f
,
0.0
f
);
}
}
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
);
// nb
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
if
(
m2
.
isMarked
(
d
))
{
m_render_topo
->
setDartColor
(
d
,
1.0
f
,
0.0
f
,
0.0
f
);
}
if
(
m1
.
isMarked
(
d
))
{
m_render_topo
->
setDartColor
(
d
,
0.0
f
,
1.0
f
,
0.0
f
);
}
}
//
//
...
...
@@ -152,11 +152,11 @@ void MyQT::createMap()
// Dart d2 = d1;
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Surface
::
Modelisation
::
Polyhedron
<
PFP
>
prim1
(
myMap
,
position
);
prim1
.
cylinder_topo
(
256
,
256
,
true
,
true
);
// topo of sphere is a closed cylinder
prim1
.
embedSphere
(
2.0
f
);
Algo
::
Surface
::
Modelisation
::
Polyhedron
<
PFP
>
prim1
(
myMap
,
position
);
prim1
.
cylinder_topo
(
256
,
256
,
true
,
true
);
// topo of sphere is a closed cylinder
prim1
.
embedSphere
(
2.0
f
);
// Dart d2 = d1;
// position[d2] = PFP::VEC3(1, 0, 0);
...
...
@@ -167,16 +167,16 @@ void MyQT::createMap()
// d2 = PHI<211>(d2);
// position[d2] = PFP::VEC3(0, 1, 2);
Algo
::
Surface
::
Modelisation
::
Polyhedron
<
PFP
>
prim2
(
myMap
,
position
);
prim2
.
cylinder_topo
(
256
,
256
,
true
,
true
);
// topo of sphere is a closed cylinder
prim2
.
embedSphere
(
2.0
f
);
Algo
::
Surface
::
Modelisation
::
Polyhedron
<
PFP
>
prim2
(
myMap
,
position
);
prim2
.
cylinder_topo
(
256
,
256
,
true
,
true
);
// topo of sphere is a closed cylinder
prim2
.
embedSphere
(
2.0
f
);
Geom
::
Matrix44f
trf
;
trf
.
identity
();
Geom
::
translate
<
float
>
(
5.0
f
,
0.0
,
0.0
,
trf
);
prim2
.
transform
(
trf
);
Geom
::
Matrix44f
trf
;
trf
.
identity
();
Geom
::
translate
<
float
>
(
5.0
f
,
0.0
,
0.0
,
trf
);
prim2
.
transform
(
trf
);
xd1
=
prim2
.
getDart
();
xd1
=
prim2
.
getDart
();
// xd1 = Algo::Modelisation::Polyhedron<PFP>::createTetra(myMap);
// Dart xd2 = xd1;
...
...
@@ -195,40 +195,40 @@ void MyQT::createMap()
Geom
::
Vec3f
lPosObj
=
(
bb
.
min
()
+
bb
.
max
())
/
PFP
::
REAL
(
2
);