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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
3a8ecd23
Commit
3a8ecd23
authored
Dec 23, 2012
by
Thery Sylvain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish (??) Volume/Surface namspace for Algo
parent
4fa2f232
Changes
52
Hide whitespace changes
Inline
Side-by-side
Showing
52 changed files
with
342 additions
and
214 deletions
+342
-214
Apps/Examples/clipping.cpp
Apps/Examples/clipping.cpp
+3
-3
Apps/Examples/concave_rendering.cpp
Apps/Examples/concave_rendering.cpp
+1
-1
Apps/Examples/extrusionView.cpp
Apps/Examples/extrusionView.cpp
+1
-1
Apps/Examples/mcmesh.cpp
Apps/Examples/mcmesh.cpp
+5
-5
Apps/Examples/mcmesh.h
Apps/Examples/mcmesh.h
+3
-1
Apps/Examples/simpleGMap2.cpp
Apps/Examples/simpleGMap2.cpp
+2
-2
Apps/Examples/simpleGMap3.cpp
Apps/Examples/simpleGMap3.cpp
+4
-4
Apps/Examples/simpleMap3.cpp
Apps/Examples/simpleMap3.cpp
+1
-1
Apps/Examples/texturesExample.cpp
Apps/Examples/texturesExample.cpp
+1
-1
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+4
-4
Apps/Examples/volumeExplorer.cpp
Apps/Examples/volumeExplorer.cpp
+7
-7
Apps/Tuto/show_traversors.cpp
Apps/Tuto/show_traversors.cpp
+1
-1
Apps/Tuto/tuto3.cpp
Apps/Tuto/tuto3.cpp
+2
-2
Apps/Tuto/tuto4.cpp
Apps/Tuto/tuto4.cpp
+1
-1
Apps/Tuto/tuto5.cpp
Apps/Tuto/tuto5.cpp
+2
-2
Apps/Tuto/tuto_histo.cpp
Apps/Tuto/tuto_histo.cpp
+2
-2
Apps/Tuto/tuto_mt.cpp
Apps/Tuto/tuto_mt.cpp
+2
-2
Apps/Tuto/tuto_oper2.cpp
Apps/Tuto/tuto_oper2.cpp
+5
-5
Apps/Tuto/tuto_oper3.cpp
Apps/Tuto/tuto_oper3.cpp
+7
-7
Apps/Tuto/tuto_orbits.cpp
Apps/Tuto/tuto_orbits.cpp
+1
-1
Apps/Tuto/tuto_subdivision.cpp
Apps/Tuto/tuto_subdivision.cpp
+3
-3
include/Algo/Geometry/area.hpp
include/Algo/Geometry/area.hpp
+1
-1
include/Algo/Geometry/centroid.h
include/Algo/Geometry/centroid.h
+69
-9
include/Algo/Geometry/centroid.hpp
include/Algo/Geometry/centroid.hpp
+79
-34
include/Algo/Geometry/normal.h
include/Algo/Geometry/normal.h
+5
-0
include/Algo/Geometry/normal.hpp
include/Algo/Geometry/normal.hpp
+5
-0
include/Algo/Geometry/volume.hpp
include/Algo/Geometry/volume.hpp
+3
-3
include/Algo/Import/import2tables.h
include/Algo/Import/import2tables.h
+1
-1
include/Algo/Import/import2tablesVolume.hpp
include/Algo/Import/import2tablesVolume.hpp
+11
-11
include/Algo/Import/importMesh.hpp
include/Algo/Import/importMesh.hpp
+15
-15
include/Algo/Import/importNodeEle.hpp
include/Algo/Import/importNodeEle.hpp
+6
-1
include/Algo/Import/importObjEle.hpp
include/Algo/Import/importObjEle.hpp
+5
-3
include/Algo/Import/importObjTex.hpp
include/Algo/Import/importObjTex.hpp
+3
-1
include/Algo/Import/importTet.hpp
include/Algo/Import/importTet.hpp
+1
-1
include/Algo/Import/importTs.hpp
include/Algo/Import/importTs.hpp
+1
-1
include/Algo/Modelisation/extrusion.hpp
include/Algo/Modelisation/extrusion.hpp
+2
-2
include/Algo/Modelisation/polyhedron.hpp
include/Algo/Modelisation/polyhedron.hpp
+2
-2
include/Algo/Modelisation/primitives3d.h
include/Algo/Modelisation/primitives3d.h
+5
-0
include/Algo/Modelisation/primitives3d.hpp
include/Algo/Modelisation/primitives3d.hpp
+7
-2
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+5
-5
include/Algo/Modelisation/subdivision3.hpp
include/Algo/Modelisation/subdivision3.hpp
+8
-8
include/Algo/Modelisation/tetrahedralization.hpp
include/Algo/Modelisation/tetrahedralization.hpp
+12
-12
include/Algo/Modelisation/triangulation.hpp
include/Algo/Modelisation/triangulation.hpp
+1
-1
include/Algo/Render/GL1/renderFunctor.hpp
include/Algo/Render/GL1/renderFunctor.hpp
+17
-17
include/Algo/Render/GL2/drawerCells.hpp
include/Algo/Render/GL2/drawerCells.hpp
+2
-2
include/Algo/Render/GL2/explodeVolumeRender.hpp
include/Algo/Render/GL2/explodeVolumeRender.hpp
+4
-4
include/Algo/Render/GL2/mapRender.hpp
include/Algo/Render/GL2/mapRender.hpp
+1
-1
include/Algo/Render/GL2/topo3Render.hpp
include/Algo/Render/GL2/topo3Render.hpp
+2
-2
include/Algo/Selection/raySelectFunctor.hpp
include/Algo/Selection/raySelectFunctor.hpp
+1
-17
include/Topology/generic/attributeHandler.h
include/Topology/generic/attributeHandler.h
+2
-2
include/Topology/gmap/gmap3.h
include/Topology/gmap/gmap3.h
+3
-0
include/Topology/map/map3.h
include/Topology/map/map3.h
+5
-0
No files found.
Apps/Examples/clipping.cpp
View file @
3a8ecd23
...
...
@@ -792,7 +792,7 @@ void Clipping::importMesh(std::string& filename)
if(extension == std::string(".tet"))
{
if
(
!
Algo
::
Import
::
importTet
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
if(!Algo::
Volume::
Import::importTet<PFP>(myMap,filename.c_str(),attrNames))
{
CGoGNerr << "could not import " << filename << CGoGNendl ;
return;
...
...
@@ -802,7 +802,7 @@ void Clipping::importMesh(std::string& filename)
}
else if(extension == std::string(".ts"))
{
if
(
!
Algo
::
Import
::
importTs
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
if(!Algo::
Volume::
Import::importTs<PFP>(myMap,filename.c_str(),attrNames))
{
CGoGNerr << "could not import " << filename << CGoGNendl ;
return;
...
...
@@ -1124,7 +1124,7 @@ int main(int argc, char** argv)
else
{
sqt.position = sqt.myMap.addAttribute<PFP::VEC3, VERTEX>("position");
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
sqt
.
myMap
,
sqt
.
position
);
Algo::
Volume::
Modelisation::Primitive3D<PFP> prim(sqt.myMap, sqt.position);
prim.hexaGrid_topo(10,10,10);
prim.embedHexaGrid(1.0f,1.0f,1.0f);
}
...
...
Apps/Examples/concave_rendering.cpp
View file @
3a8ecd23
...
...
@@ -213,7 +213,7 @@ void MyQT::cb_keyPress(int code)
case
't'
:
{
Algo
::
Modelisation
::
EarTriangulation
<
PFP
>
triangulation
(
myMap
);
Algo
::
Surface
::
Modelisation
::
EarTriangulation
<
PFP
>
triangulation
(
myMap
);
triangulation
.
triangule
();
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
...
...
Apps/Examples/extrusionView.cpp
View file @
3a8ecd23
...
...
@@ -133,7 +133,7 @@ int main(int argc, char **argv)
}
// extrusion
Algo
::
Modelisation
::
extrusion_scale
<
PFP
>
(
myMap
,
position
,
objV
,
PFP
::
VEC3
(
0.0
,
0.0
,
0.0
),
PFP
::
VEC3
(
0.0
,
1.0
,
0.0
),
true
,
pathV
,
false
,
pathRadius
);
Algo
::
Surface
::
Modelisation
::
extrusion_scale
<
PFP
>
(
myMap
,
position
,
objV
,
PFP
::
VEC3
(
0.0
,
0.0
,
0.0
),
PFP
::
VEC3
(
0.0
,
1.0
,
0.0
),
true
,
pathV
,
false
,
pathRadius
);
// bounding box
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
...
...
Apps/Examples/mcmesh.cpp
View file @
3a8ecd23
...
...
@@ -133,9 +133,9 @@ void MCMesh::MC()
{
myMap
.
clear
(
false
);
// elargir l'image pour le calcul de la courbure
Algo
::
MC
::
Image
<
DATATYPE
>*
myImgFr
=
myImg
->
addFrame
(
1
);
S
Algo
::
MC
::
Image
<
DATATYPE
>*
myImgFr
=
myImg
->
addFrame
(
1
);
Algo
::
MC
::
WindowingGreater
<
DATATYPE
>
myWindFunc
;
S
Algo
::
MC
::
WindowingGreater
<
DATATYPE
>
myWindFunc
;
myWindFunc
.
setIsoValue
(
DATATYPE
(
127
));
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
...
...
@@ -143,7 +143,7 @@ void MCMesh::MC()
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
// instanciation du mc
Algo
::
MC
::
MarchingCube
<
DATATYPE
,
Algo
::
MC
::
WindowingGreater
,
PFP
>
mc
(
myImgFr
,
&
myMap
,
position
,
myWindFunc
,
false
);
SAlgo
::
MC
::
MarchingCube
<
DATATYPE
,
S
Algo
::
MC
::
WindowingGreater
,
PFP
>
mc
(
myImgFr
,
&
myMap
,
position
,
myWindFunc
,
false
);
mc
.
simpleMeshing
();
delete
myImgFr
;
...
...
@@ -168,7 +168,7 @@ void MCMesh::updateRender()
void
MCMesh
::
fromFile
(
char
*
fname
)
{
myImg
=
new
Algo
::
MC
::
Image
<
DATATYPE
>
();
myImg
=
new
S
Algo
::
MC
::
Image
<
DATATYPE
>
();
myImg
->
loadInrgz
(
fname
);
CGoGNout
<<
"Image chargee"
<<
CGoGNendl
;
CGoGNout
<<
myImg
->
getWidthX
()
<<
"x"
<<
myImg
->
getWidthY
()
<<
"x"
<<
myImg
->
getWidthZ
()
<<
"voxels"
<<
CGoGNendl
;
...
...
@@ -193,7 +193,7 @@ void MCMesh::sphere()
}
}
myImg
=
new
Algo
::
MC
::
Image
<
DATATYPE
>
(
img
,
128
,
128
,
128
,
1.0
f
,
1.0
f
,
1.0
f
,
false
);
myImg
=
new
S
Algo
::
MC
::
Image
<
DATATYPE
>
(
img
,
128
,
128
,
128
,
1.0
f
,
1.0
f
,
1.0
f
,
false
);
}
...
...
Apps/Examples/mcmesh.h
View file @
3a8ecd23
...
...
@@ -46,6 +46,8 @@
using
namespace
CGoGN
;
namespace
SAlgo
=
::
CGoGN
::
Algo
::
Surface
;
struct
PFP
:
public
PFP_STANDARD
{
// definition of the map
...
...
@@ -83,7 +85,7 @@ public:
Utils
::
ShaderSimpleColor
*
m_simpleColorShader
;
DATATYPE
valLabel
;
Algo
::
MC
::
Image
<
DATATYPE
>*
myImg
;
S
Algo
::
MC
::
Image
<
DATATYPE
>*
myImg
;
MCMesh
()
;
...
...
Apps/Examples/simpleGMap2.cpp
View file @
3a8ecd23
...
...
@@ -31,7 +31,7 @@ SimpleGMap2::SimpleGMap2()
{
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Dart
d
=
Algo
::
Modelisation
::
createTetrahedron
<
PFP
>
(
myMap
);
Dart
d
=
Algo
::
Surface
::
Modelisation
::
createTetrahedron
<
PFP
>
(
myMap
);
position
[
d
]
=
VEC3
(
0
,
0
,
0
);
position
[
myMap
.
phi1
(
d
)]
=
VEC3
(
10
,
0
,
15
);
position
[
myMap
.
phi_1
(
d
)]
=
VEC3
(
10
,
20
,
15
);
...
...
@@ -41,7 +41,7 @@ SimpleGMap2::SimpleGMap2()
myMap
.
cutEdge
(
d
);
position
[
myMap
.
phi1
(
d
)]
=
mid
;
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
poly
(
myMap
,
position
);
Algo
::
Surface
::
Modelisation
::
Polyhedron
<
PFP
>
poly
(
myMap
,
position
);
d
=
poly
.
cylinder_topo
(
5
,
1
,
false
,
false
);
...
...
Apps/Examples/simpleGMap3.cpp
View file @
3a8ecd23
...
...
@@ -36,7 +36,7 @@ SimpleGMap3::SimpleGMap3()
CellMarker
<
EDGE
>
mE
(
myMap
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
3
,
1
,
1
);
primCat
.
embedHexaGrid
(
2
,
1
,
1
);
myMap
.
check
();
...
...
@@ -56,14 +56,14 @@ SimpleGMap3::SimpleGMap3()
// 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
);
Algo
::
Volume
::
Modelisation
::
sliceConvexVolume
<
PFP
>
(
myMap
,
position
,
d
,
pl
);
myMap
.
check
();
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
position
[
i
]
+=
VEC3
(
2
,
0
,
0
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
d
=
prim
.
hexaGrid_topo
(
2
,
2
,
1
);
prim
.
embedHexaGrid
(
1
,
1
,
1
);
...
...
@@ -88,7 +88,7 @@ SimpleGMap3::SimpleGMap3()
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
position
[
i
]
+=
VEC3
(
0
,
2
,
0
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim2
(
myMap
,
position
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim2
(
myMap
,
position
);
d
=
prim2
.
hexaGrid_topo
(
2
,
1
,
1
);
prim2
.
embedHexaGrid
(
1
,
1
,
1
);
...
...
Apps/Examples/simpleMap3.cpp
View file @
3a8ecd23
...
...
@@ -32,7 +32,7 @@ SimpleMap3::SimpleMap3()
{
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
2
,
1
,
1
);
primCat
.
embedHexaGrid
(
1
,
1
,
1
);
...
...
Apps/Examples/texturesExample.cpp
View file @
3a8ecd23
...
...
@@ -232,7 +232,7 @@ int main(int argc, char**argv)
#define NB 96
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim
(
m
,
position
);
Algo
::
Surface
::
Modelisation
::
Polyhedron
<
PFP
>
prim
(
m
,
position
);
prim
.
tore_topo
(
NB
,
NB
);
prim
.
embedTore
(
40.0
f
,
20.0
f
);
...
...
Apps/Examples/viewer.cpp
View file @
3a8ecd23
...
...
@@ -219,7 +219,7 @@ void Viewer::importMesh(std::string& filename)
else
{
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
if
(
!
Algo
::
Surface
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
...
...
@@ -243,7 +243,7 @@ void Viewer::importMesh(std::string& filename)
if
(
!
normal
.
isValid
())
normal
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"normal"
)
;
Algo
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
m_positionVBO
->
updateData
(
position
)
;
m_normalVBO
->
updateData
(
normal
)
;
...
...
@@ -258,7 +258,7 @@ void Viewer::exportMesh(std::string& filename, bool askExportMode)
std
::
string
extension
=
filename
.
substr
(
pos
)
;
if
(
extension
==
std
::
string
(
".off"
))
Algo
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
(),
allDarts
)
;
Algo
::
Surface
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
(),
allDarts
)
;
else
if
(
extension
.
compare
(
0
,
4
,
std
::
string
(
".ply"
))
==
0
)
{
int
ascii
=
0
;
...
...
@@ -267,7 +267,7 @@ void Viewer::exportMesh(std::string& filename, bool askExportMode)
std
::
vector
<
VertexAttribute
<
VEC3
>*>
attributes
;
attributes
.
push_back
(
&
position
)
;
Algo
::
Export
::
exportPLYnew
<
PFP
>
(
myMap
,
attributes
,
filename
.
c_str
(),
!
ascii
,
allDarts
)
;
Algo
::
Surface
::
Export
::
exportPLYnew
<
PFP
>
(
myMap
,
attributes
,
filename
.
c_str
(),
!
ascii
,
allDarts
)
;
}
else
if
(
extension
==
std
::
string
(
".map"
))
myMap
.
saveMapBin
(
filename
)
;
...
...
Apps/Examples/volumeExplorer.cpp
View file @
3a8ecd23
...
...
@@ -146,7 +146,7 @@ void MyQT::cb_Open()
if
(
extension
==
std
::
string
(
".tet"
))
{
if
(
!
Algo
::
Import
::
importTet
<
PFP
>
(
myMap
,
filename
,
attrNames
))
if
(
!
Algo
::
Volume
::
Import
::
importTet
<
PFP
>
(
myMap
,
filename
,
attrNames
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
...
...
@@ -157,7 +157,7 @@ void MyQT::cb_Open()
if
(
extension
==
std
::
string
(
".node"
))
{
if
(
!
Algo
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
filename
,
attrNames
,
Algo
::
Import
::
ImportVolumique
::
NODE
))
if
(
!
Algo
::
Volume
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
filename
,
attrNames
,
Algo
::
Volume
::
Import
::
NODE
))
{
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
;
...
...
@@ -169,7 +169,7 @@ void MyQT::cb_Open()
if
(
extension
==
std
::
string
(
".off"
))
{
if
(
!
Algo
::
Import
::
importMeshToExtrude
<
PFP
>
(
myMap
,
filename
,
attrNames
))
if
(
!
Algo
::
Volume
::
Import
::
importMeshToExtrude
<
PFP
>
(
myMap
,
filename
,
attrNames
))
{
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
;
...
...
@@ -388,7 +388,7 @@ int main(int argc, char **argv)
if
(
extension
==
std
::
string
(
".tet"
))
{
if
(
!
Algo
::
Import
::
importTet
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
))
if
(
!
Algo
::
Volume
::
Import
::
importTet
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
))
{
CGoGNerr
<<
"could not import "
<<
argv
[
1
]
<<
CGoGNendl
;
return
1
;
...
...
@@ -399,7 +399,7 @@ int main(int argc, char **argv)
if
(
extension
==
std
::
string
(
".node"
))
{
if
(
!
Algo
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
,
Algo
::
Import
::
ImportVolumique
::
NODE
))
if
(
!
Algo
::
Volume
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
,
Algo
::
Volume
::
Import
::
NODE
))
{
std
::
cerr
<<
"could not import "
<<
argv
[
1
]
<<
std
::
endl
;
return
1
;
...
...
@@ -411,7 +411,7 @@ int main(int argc, char **argv)
if
(
extension
==
std
::
string
(
".off"
))
{
if
(
!
Algo
::
Import
::
importMeshToExtrude
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
))
if
(
!
Algo
::
Volume
::
Import
::
importMeshToExtrude
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
))
{
std
::
cerr
<<
"could not import "
<<
std
::
endl
;
return
1
;
...
...
@@ -443,7 +443,7 @@ int main(int argc, char **argv)
else
{
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
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
);
...
...
Apps/Tuto/show_traversors.cpp
View file @
3a8ecd23
...
...
@@ -603,7 +603,7 @@ int main(int argc, char **argv)
{
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
dglobal
=
prim
.
hexaGrid_topo
(
4
,
4
,
4
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
);
...
...
Apps/Tuto/tuto3.cpp
View file @
3a8ecd23
...
...
@@ -154,7 +154,7 @@ void MyQT::createMap()
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim1
(
myMap
,
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
);
...
...
@@ -167,7 +167,7 @@ void MyQT::createMap()
// d2 = PHI<211>(d2);
// position[d2] = PFP::VEC3(0, 1, 2);
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim2
(
myMap
,
position
);
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
);
...
...
Apps/Tuto/tuto4.cpp
View file @
3a8ecd23
...
...
@@ -119,7 +119,7 @@ void MyQT::traverseMap()
void
MyQT
::
createMap
()
{
Dart
d1
=
Algo
::
Modelisation
::
createHexahedron
<
PFP
>
(
myMap
);
Dart
d1
=
Algo
::
Surface
::
Modelisation
::
createHexahedron
<
PFP
>
(
myMap
);
Dart
d2
=
d1
;
...
...
Apps/Tuto/tuto5.cpp
View file @
3a8ecd23
...
...
@@ -259,7 +259,7 @@ void MyQT::cb_keyPress(int code)
if
(
code
==
'c'
)
{
//SelectorDartNoBoundary<PFP::MAP> nb(myMap);
Algo
::
Modelisation
::
catmullClarkVol
<
PFP
>
(
myMap
,
position
);
Algo
::
Volume
::
Modelisation
::
catmullClarkVol
<
PFP
>
(
myMap
,
position
);
m_positionVBO
->
updateData
(
position
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
...
...
@@ -277,7 +277,7 @@ int main(int argc, char **argv)
CGoGNout
<<
5.34
<<
" toto "
<<
Geom
::
Vec3f
(
2.5
f
,
2.2
f
,
4.3
f
)
<<
CGoGNendl
;
CGoGNout
<<
3
<<
" tutu "
<<
4
<<
CGoGNendl
;
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
int
nb
=
3
;
if
(
argc
>
1
)
nb
=
atoi
(
argv
[
1
]);
...
...
Apps/Tuto/tuto_histo.cpp
View file @
3a8ecd23
...
...
@@ -68,7 +68,7 @@ void MyQT::createMap(const std::string& filename)
std
::
string
extension
=
filename
.
substr
(
pos
);
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
if
(
!
Algo
::
Surface
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
...
...
@@ -82,7 +82,7 @@ void MyQT::createMap(const std::string& filename)
VertexAttribute
<
VEC3
>
colorF
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"colorF"
);
// compute the area attribute
Algo
::
Geometry
::
computeOneRingAreaVertices
<
PFP
>
(
myMap
,
position
,
area
);
Algo
::
Surface
::
Geometry
::
computeOneRingAreaVertices
<
PFP
>
(
myMap
,
position
,
area
);
// just some tricks to obtain relatives value
float
amax
=
0
;
...
...
Apps/Tuto/tuto_mt.cpp
View file @
3a8ecd23
...
...
@@ -87,7 +87,7 @@ void MyQT::cb_initGL()
m_lines
->
setScale
(
2.0
f
);
m_lines
->
setColor
(
Geom
::
Vec4f
(
0.0
f
,
1.0
f
,
0.2
f
,
0.0
f
));
Algo
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
POINTS
);
...
...
@@ -298,7 +298,7 @@ int main(int argc, char **argv)
if
(
argc
==
2
)
nbt
=
atoi
(
argv
[
1
]);
// create a sphere
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim
(
myMap
,
position
);
Algo
::
Surface
::
Modelisation
::
Polyhedron
<
PFP
>
prim
(
myMap
,
position
);
prim
.
cylinder_topo
(
nbt
,
nbt
,
true
,
true
);
prim
.
embedSphere
(
20.0
f
);
...
...
Apps/Tuto/tuto_oper2.cpp
View file @
3a8ecd23
...
...
@@ -73,8 +73,8 @@ void MyQT::operation(int x)
{
dm
.
markAll
();
myMap
.
splitVertex
(
m_selected
,
m_selected2
);
PFP
::
VEC3
c1
=
Algo
::
Geometry
::
faceCentroid
<
PFP
>
(
myMap
,
m_selected
,
position
);
PFP
::
VEC3
c2
=
Algo
::
Geometry
::
faceCentroid
<
PFP
>
(
myMap
,
m_selected2
,
position
);
PFP
::
VEC3
c1
=
Algo
::
Surface
::
Geometry
::
faceCentroid
<
PFP
>
(
myMap
,
m_selected
,
position
);
PFP
::
VEC3
c2
=
Algo
::
Surface
::
Geometry
::
faceCentroid
<
PFP
>
(
myMap
,
m_selected2
,
position
);
position
[
m_selected
]
=
position
[
m_selected
]
*
0.7
f
+
c1
*
0.3
f
;
position
[
m_selected2
]
=
position
[
m_selected2
]
*
0.7
f
+
c2
*
0.3
f
;
updateMap
();
...
...
@@ -175,7 +175,7 @@ void MyQT::createMap(int n)
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
colorDarts
=
myMap
.
addAttribute
<
VEC3
,
DART
>
(
"color"
);
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
grid
(
myMap
,
position
);
Algo
::
Surface
::
Modelisation
::
Polyhedron
<
PFP
>
grid
(
myMap
,
position
);
grid
.
grid_topo
(
n
,
n
);
grid
.
embedGrid
(
1.
,
1.
,
0.
);
...
...
@@ -356,7 +356,7 @@ void MyQT::cb_Open()
void
MyQT
::
cb_Save
()
{
std
::
string
filename
=
selectFileSave
(
"Export SVG file "
,
"."
,
"(*.off)"
);
Algo
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
());
Algo
::
Surface
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
());
}
void
MyQT
::
importMesh
(
std
::
string
&
filename
)
...
...
@@ -374,7 +374,7 @@ void MyQT::importMesh(std::string& filename)
else
{
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
if
(
!
Algo
::
Surface
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
...
...
Apps/Tuto/tuto_oper3.cpp
View file @
3a8ecd23
...
...
@@ -196,7 +196,7 @@ void MyQT::operation(int x)
CGoGNout
<<
"collapse face"
<<
CGoGNendl
;
if
(
m_selected
!=
NIL
)
{
PFP
::
VEC3
Q
=
Algo
::
Geometry
::
faceCentroid
<
PFP
>
(
myMap
,
m_selected
,
position
);
PFP
::
VEC3
Q
=
Algo
::
Surface
::
Geometry
::
faceCentroid
<
PFP
>
(
myMap
,
m_selected
,
position
);
Dart
x
=
myMap
.
collapseFace
(
m_selected
);
dm
.
markAll
();
position
[
x
]
=
Q
;
...
...
@@ -208,7 +208,7 @@ void MyQT::operation(int x)
CGoGNout
<<
"collapse volume"
<<
CGoGNendl
;
if
(
m_selected
!=
NIL
)
{
PFP
::
VEC3
Q
=
Algo
::
Geometry
::
volumeCentroid
<
PFP
>
(
myMap
,
m_selected
,
position
);
PFP
::
VEC3
Q
=
Algo
::
Surface
::
Geometry
::
volumeCentroid
<
PFP
>
(
myMap
,
m_selected
,
position
);
Dart
x
=
myMap
.
collapseVolume
(
m_selected
);
dm
.
markAll
();
position
[
x
]
=
Q
;
...
...
@@ -248,7 +248,7 @@ void MyQT::createMap(int n)
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
if
(
!
position
.
isValid
())
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
prim
.
hexaGrid_topo
(
n
,
n
,
n
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
);
...
...
@@ -603,7 +603,7 @@ void MyQT::cb_Open()
void
MyQT
::
cb_Save
()
{
std
::
string
filename
=
selectFileSave
(
"Export SVG file "
,
"."
,
"(*.off)"
);
Algo
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
());
Algo
::
Surface
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
filename
.
c_str
());
// ???
}
void
MyQT
::
importMesh
(
std
::
string
&
filename
)
...
...
@@ -621,7 +621,7 @@ void MyQT::importMesh(std::string& filename)
else
if
(
extension
==
std
::
string
(
".node"
))
{
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
filename
,
attrNames
,
Algo
::
Import
::
ImportVolumique
::
NODE
))
if
(
!
Algo
::
Volume
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
filename
,
attrNames
,
Algo
::
Volume
::
Import
::
NODE
))
{
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
;
...
...
@@ -631,7 +631,7 @@ void MyQT::importMesh(std::string& filename)
else
if
(
extension
==
std
::
string
(
".tet"
))
{
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
filename
,
attrNames
,
Algo
::
Import
::
ImportVolumique
::
TET
))
if
(
!
Algo
::
Volume
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
filename
,
attrNames
,
Algo
::
Volume
::
Import
::
TET
))
{
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
;
...
...
@@ -641,7 +641,7 @@ void MyQT::importMesh(std::string& filename)
else
if
(
extension
==
std
::
string
(
".off"
))
{
std
::
vector
<
std
::
string
>
attrNames
;
if
(
!
Algo
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
filename
,
attrNames
,
Algo
::
Import
::
ImportVolumique
::
OFF
))
if
(
!
Algo
::
Volume
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
filename
,
attrNames
,
Algo
::
Volume
::
Import
::
OFF
))
{
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
;
...
...
Apps/Tuto/tuto_orbits.cpp
View file @
3a8ecd23
...
...
@@ -202,7 +202,7 @@ void MyQT::initMap()
std
::
cout
<<
"INIT MAP"
<<
std
::
endl
;
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
int
nb
=
2
;
prim
.
hexaGrid_topo
(
nb
,
nb
,
nb
);
prim
.
embedHexaGrid
(
1.0
f
,
1.0
f
,
1.0
f
);
...
...
Apps/Tuto/tuto_subdivision.cpp
View file @
3a8ecd23
...
...
@@ -64,15 +64,15 @@ int main(int argc, char **argv)
PFP
::
MAP
myMap
;
std
::
vector
<
std
::
string
>
attrNames
;
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
);
Algo
::
Surface
::
Import
::
importMesh
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
);
// get a handler to the 3D vector attribute created by the import
VertexAttribute
<
PFP
::
VEC3
>
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
]);
for
(
unsigned
int
i
=
0
;
i
<
nbSteps
;
++
i
)
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
);
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
myMap
,
position
);
Algo
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
"result.off"
);
Algo
::
Surface
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
"result.off"
);
return
0
;
}
include/Algo/Geometry/area.hpp
View file @
3a8ecd23
...
...
@@ -59,7 +59,7 @@ typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Dart d, const VertexAt
else
{
float
area
=
0.0
f
;
VEC3
centroid
=
Algo
::
Geometry
::
faceCentroid
<
PFP
>
(
map
,
d
,
position
)
;
VEC3
centroid
=
faceCentroid
<
PFP
>
(
map
,
d
,
position
)
;
Traversor2FE
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
...
...
include/Algo/Geometry/centroid.h
View file @
3a8ecd23
...
...
@@ -119,21 +119,86 @@ typename PFP::VEC3 vertexNeighborhoodCentroid(typename PFP::MAP& map, Dart d, co
}
template
<
typename
PFP
>
void
computeCentroid
Volum
es
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
VolumeAttribute
<
typename
PFP
::
VEC3
>&
vol
_centroid
,
void
computeCentroid
Fac
es
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
FaceAttribute
<
typename
PFP
::
VEC3
>&
face
_centroid
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
void
computeNeighborhoodCentroidVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
vertex_centroid
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
namespace
Parallel
{
template
<
typename
PFP
>
void
computeCentroidFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
FaceAttribute
<
typename
PFP
::
VEC3
>&
face_centroid
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
nbth
=
0
)
;
template
<
typename
PFP
>
void
computeNeighborhoodCentroidVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
vertex_centroid
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
nbth
=
0
)
;
}
}
// namespace Geometry
}
namespace
Volume
{
namespace
Geometry
{
/**
* Compute vertex neighbours centroid in map of dimension 3(generic version)
* Template param:
* PFP: as usual
* EMBV: attributes vector type or cell type (VertexCell, FaceCell, ...)
* EMB: type of attribute (Geom::Vec3f) or cell type (VertexCell, FaceCell, ...)
* @param map the map
* @param d a dart of the face
* @param position the vector of attribute or cell
*/
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
EMB
vertexNeighborhoodCentroidGen
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
EMBV
&
attributs
);
/**
* Compute vertex neighbours centroid in map of dimension 3
* @param map the map
* @param d a dart of the face
* @param position the vector of attribute
*/
template
<
typename
PFP
>
typename
PFP
::
VEC3
vertexNeighborhoodCentroid
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
{
return
vertexNeighborhoodCentroidGen
<
PFP
,
VertexAttribute
<
typename
PFP
::
VEC3
>
,
typename
PFP
::
VEC3
>
(
map
,
d
,
position
);
}
/**
* compute centroid of all volumes
* @param map the map
* @param position vertex attribute of position
* @param vol_centroid volume attribute where to store the centroids
* @param select the selector
*/
template
<
typename
PFP
>
void
computeCentroidVolumes
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
VolumeAttribute
<
typename
PFP
::
VEC3
>&
vol_centroid
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
/**
* compute centroid of all vertices
* @param map the map
* @param position vertex attribute of position
* @param vertex_centroid vertex attribute to store the centroids
* @param select the selector
*/
template
<
typename
PFP
>
void
computeNeighborhoodCentroidVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
vertex_centroid
,
const
FunctorSelect
&
select
=
allDarts
,
unsigned
int
thread
=
0
)
;
namespace
Parallel
{
template
<
typename
PFP
>
...
...
@@ -141,20 +206,15 @@ void computeCentroidVolumes(typename PFP::MAP& map,