Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
KennethVanhoey
CGoGN
Commits
3d4119e2
Commit
3d4119e2
authored
Sep 02, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'AttGenOrbit' into develop
parents
2c1e4b36
82cf5ae8
Changes
102
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
102 changed files
with
2448 additions
and
1116 deletions
+2448
-1116
Apps/CMakeLists.txt
Apps/CMakeLists.txt
+1
-1
Apps/Examples/volumeExplorer.cpp
Apps/Examples/volumeExplorer.cpp
+4
-5
Apps/SandBox/CMakeLists.txt
Apps/SandBox/CMakeLists.txt
+3
-0
Apps/SandBox/trav3_test.cpp
Apps/SandBox/trav3_test.cpp
+193
-0
Apps/Tuto/Attributes/multi_attribs.cpp
Apps/Tuto/Attributes/multi_attribs.cpp
+7
-0
Apps/Tuto/Attributes/simple_attribs.cpp
Apps/Tuto/Attributes/simple_attribs.cpp
+34
-0
Apps/Tuto/Traversals/traverse_attributes.cpp
Apps/Tuto/Traversals/traverse_attributes.cpp
+13
-2
Apps/Tuto/Traversals/traverse_cells.cpp
Apps/Tuto/Traversals/traverse_cells.cpp
+6
-3
Apps/Tuto/Traversals/traverse_neighbours.cpp
Apps/Tuto/Traversals/traverse_neighbours.cpp
+11
-0
Apps/Tuto/tuto_dual3.cpp
Apps/Tuto/tuto_dual3.cpp
+1
-1
CMakeLists.txt
CMakeLists.txt
+2
-1
SCHNApps/include/cellSelector.h
SCHNApps/include/cellSelector.h
+2
-2
apps_cmake.txt
apps_cmake.txt
+1
-1
include/Algo/Export/export.hpp
include/Algo/Export/export.hpp
+7
-5
include/Algo/Geometry/area.h
include/Algo/Geometry/area.h
+5
-5
include/Algo/Geometry/area.hpp
include/Algo/Geometry/area.hpp
+14
-14
include/Algo/Geometry/centroid.h
include/Algo/Geometry/centroid.h
+9
-12
include/Algo/Geometry/centroid.hpp
include/Algo/Geometry/centroid.hpp
+32
-32
include/Algo/Geometry/curvature.h
include/Algo/Geometry/curvature.h
+12
-24
include/Algo/Geometry/curvature.hpp
include/Algo/Geometry/curvature.hpp
+38
-48
include/Algo/Geometry/feature.h
include/Algo/Geometry/feature.h
+6
-12
include/Algo/Geometry/feature.hpp
include/Algo/Geometry/feature.hpp
+12
-18
include/Algo/Geometry/inclusion.h
include/Algo/Geometry/inclusion.h
+1
-1
include/Algo/Geometry/inclusion.hpp
include/Algo/Geometry/inclusion.hpp
+4
-4
include/Algo/Geometry/normal.h
include/Algo/Geometry/normal.h
+3
-4
include/Algo/Geometry/normal.hpp
include/Algo/Geometry/normal.hpp
+9
-9
include/Algo/Geometry/volume.h
include/Algo/Geometry/volume.h
+2
-2
include/Algo/Geometry/volume.hpp
include/Algo/Geometry/volume.hpp
+10
-10
include/Algo/ImplicitHierarchicalMesh/ihm3.h
include/Algo/ImplicitHierarchicalMesh/ihm3.h
+14
-14
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
+41
-41
include/Algo/Import/import.h
include/Algo/Import/import.h
+1
-1
include/Algo/Import/import.hpp
include/Algo/Import/import.hpp
+1
-1
include/Algo/Modelisation/polyhedron.h
include/Algo/Modelisation/polyhedron.h
+2
-2
include/Algo/Modelisation/polyhedron.hpp
include/Algo/Modelisation/polyhedron.hpp
+4
-4
include/Algo/Modelisation/subdivision.h
include/Algo/Modelisation/subdivision.h
+59
-6
include/Algo/Modelisation/subdivision3.h
include/Algo/Modelisation/subdivision3.h
+1
-1
include/Algo/Modelisation/subdivision3.hpp
include/Algo/Modelisation/subdivision3.hpp
+2
-2
include/Algo/Modelisation/tetrahedralization.h
include/Algo/Modelisation/tetrahedralization.h
+2
-2
include/Algo/Modelisation/tetrahedralization.hpp
include/Algo/Modelisation/tetrahedralization.hpp
+5
-5
include/Algo/Modelisation/triangulation.h
include/Algo/Modelisation/triangulation.h
+1
-1
include/Algo/Modelisation/triangulation.hpp
include/Algo/Modelisation/triangulation.hpp
+3
-3
include/Algo/Render/GL2/explodeVolumeRender.hpp
include/Algo/Render/GL2/explodeVolumeRender.hpp
+4
-4
include/Algo/Render/GL2/mapRender.h
include/Algo/Render/GL2/mapRender.h
+9
-9
include/Algo/Render/GL2/mapRender.hpp
include/Algo/Render/GL2/mapRender.hpp
+32
-32
include/Algo/Render/SVG/mapSVGRender.h
include/Algo/Render/SVG/mapSVGRender.h
+4
-4
include/Algo/Render/SVG/mapSVGRender.hpp
include/Algo/Render/SVG/mapSVGRender.hpp
+4
-4
include/Algo/Selection/collector.h
include/Algo/Selection/collector.h
+19
-22
include/Algo/Selection/collector.hpp
include/Algo/Selection/collector.hpp
+42
-42
include/Container/attributeContainer.h
include/Container/attributeContainer.h
+8
-1
include/Container/attributeContainer.hpp
include/Container/attributeContainer.hpp
+11
-0
include/Container/attributeMultiVector.h
include/Container/attributeMultiVector.h
+20
-0
include/Container/attributeMultiVector.hpp
include/Container/attributeMultiVector.hpp
+91
-0
include/Geometry/vector_gen.h
include/Geometry/vector_gen.h
+6
-0
include/Geometry/vector_gen.hpp
include/Geometry/vector_gen.hpp
+13
-0
include/Topology/generic/attributeHandler.h
include/Topology/generic/attributeHandler.h
+97
-2
include/Topology/generic/attributeHandler.hpp
include/Topology/generic/attributeHandler.hpp
+32
-25
include/Topology/generic/cellmarker.h
include/Topology/generic/cellmarker.h
+32
-29
include/Topology/generic/dartmarker.h
include/Topology/generic/dartmarker.h
+38
-33
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+52
-30
include/Topology/generic/genericmap.hpp
include/Topology/generic/genericmap.hpp
+48
-7
include/Topology/generic/mapCommon.h
include/Topology/generic/mapCommon.h
+10
-1
include/Topology/generic/mapCommon.hpp
include/Topology/generic/mapCommon.hpp
+10
-2
include/Topology/generic/multi3Attribs.h
include/Topology/generic/multi3Attribs.h
+2
-2
include/Topology/generic/multi4Attribs.h
include/Topology/generic/multi4Attribs.h
+2
-2
include/Topology/generic/multiAttribs.h
include/Topology/generic/multiAttribs.h
+2
-2
include/Topology/generic/traversor/iterTrav.h
include/Topology/generic/traversor/iterTrav.h
+63
-0
include/Topology/generic/traversor/traversor2.h
include/Topology/generic/traversor/traversor2.h
+185
-0
include/Topology/generic/traversor/traversor3.h
include/Topology/generic/traversor/traversor3.h
+272
-36
include/Topology/generic/traversor/traversor3.hpp
include/Topology/generic/traversor/traversor3.hpp
+13
-13
include/Topology/generic/traversor/traversor3Virt.h
include/Topology/generic/traversor/traversor3Virt.h
+28
-28
include/Topology/generic/traversor/traversor3Virt.hpp
include/Topology/generic/traversor/traversor3Virt.hpp
+13
-13
include/Topology/generic/traversor/traversorCell.h
include/Topology/generic/traversor/traversorCell.h
+140
-8
include/Topology/generic/traversor/traversorCell.hpp
include/Topology/generic/traversor/traversorCell.hpp
+25
-23
include/Topology/generic/traversor/traversorCellVirt.h
include/Topology/generic/traversor/traversorCellVirt.h
+9
-9
include/Topology/generic/traversor/traversorCellVirt.hpp
include/Topology/generic/traversor/traversorCellVirt.hpp
+4
-4
include/Topology/generic/traversor/traversorDoO.h
include/Topology/generic/traversor/traversorDoO.h
+15
-10
include/Topology/generic/traversor/traversorDoO.hpp
include/Topology/generic/traversor/traversorDoO.hpp
+10
-10
include/Topology/generic/traversor/traversorFactory.h
include/Topology/generic/traversor/traversorFactory.h
+1
-2
include/Topology/generic/traversor/traversorFactory.hpp
include/Topology/generic/traversor/traversorFactory.hpp
+11
-11
include/Topology/gmap/embeddedGMap3.h
include/Topology/gmap/embeddedGMap3.h
+1
-1
include/Topology/gmap/gmap0.h
include/Topology/gmap/gmap0.h
+4
-4
include/Topology/gmap/gmap0.hpp
include/Topology/gmap/gmap0.hpp
+8
-8
include/Topology/gmap/gmap1.h
include/Topology/gmap/gmap1.h
+6
-6
include/Topology/gmap/gmap1.hpp
include/Topology/gmap/gmap1.hpp
+12
-12
include/Topology/gmap/gmap2.h
include/Topology/gmap/gmap2.h
+13
-13
include/Topology/gmap/gmap2.hpp
include/Topology/gmap/gmap2.hpp
+35
-35
include/Topology/gmap/gmap3.h
include/Topology/gmap/gmap3.h
+16
-16
include/Topology/gmap/gmap3.hpp
include/Topology/gmap/gmap3.hpp
+48
-48
include/Topology/ihmap/ihm2.h
include/Topology/ihmap/ihm2.h
+12
-12
include/Topology/ihmap/ihm2.hpp
include/Topology/ihmap/ihm2.hpp
+36
-36
include/Topology/map/embeddedMap3.h
include/Topology/map/embeddedMap3.h
+1
-1
include/Topology/map/map1.h
include/Topology/map/map1.h
+6
-6
include/Topology/map/map1.hpp
include/Topology/map/map1.hpp
+18
-18
include/Topology/map/map2.h
include/Topology/map/map2.h
+10
-10
include/Topology/map/map2.hpp
include/Topology/map/map2.hpp
+80
-44
include/Topology/map/map3.h
include/Topology/map/map3.h
+15
-15
include/Topology/map/map3.hpp
include/Topology/map/map3.hpp
+133
-103
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+17
-2
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+17
-2
src/Topology/gmap/embeddedGMap2.cpp
src/Topology/gmap/embeddedGMap2.cpp
+1
-1
src/Topology/gmap/embeddedGMap3.cpp
src/Topology/gmap/embeddedGMap3.cpp
+2
-2
src/Topology/map/embeddedMap3.cpp
src/Topology/map/embeddedMap3.cpp
+2
-2
No files found.
Apps/CMakeLists.txt
View file @
3d4119e2
...
...
@@ -2,7 +2,7 @@
IF
(
ONELIB
)
SET
(
CGoGN_LIBS cgogn
)
ELSE
(
ONELIB
)
SET
(
CGoGN_LIBS topology
algo
container utils
)
SET
(
CGoGN_LIBS
algo
topology container utils
)
ENDIF
(
ONELIB
)
...
...
Apps/Examples/volumeExplorer.cpp
View file @
3d4119e2
...
...
@@ -169,7 +169,6 @@ void MyQT::cb_Open()
color
=
myMap
.
addAttribute
<
VEC3
,
VOLUME
,
MAP
>
(
"color"
);
TraversorCell
<
MAP
,
VOLUME
>
tra
(
myMap
);
float
maxV
=
0.0
f
;
for
(
Dart
d
=
tra
.
begin
();
d
!=
tra
.
end
();
d
=
tra
.
next
())
{
// float v = Algo::Geometry::tetrahedronVolume<PFP>(myMap, d, position);
...
...
@@ -503,11 +502,11 @@ int main(int argc, char **argv)
Utils
::
Chrono
ch
;
Vertex
v
(
myMap
.
begin
());
VEC3
p
=
Algo
::
Volume
::
Geometry
::
vertexNeighborhoodCentroid
<
PFP
>
(
myMap
,
v
,
position
);
//
Vertex v(myMap.begin());
//
VEC3 p = Algo::Volume::Geometry::vertexNeighborhoodCentroid<PFP>(myMap,v,position);
Vol
w
(
myMap
.
begin
());
VEC3
q
=
Algo
::
Surface
::
Geometry
::
volumeCentroid
<
PFP
>
(
myMap
,
w
,
position
);
//
Vol w(myMap.begin());
//
VEC3 q = Algo::Surface::Geometry::volumeCentroid<PFP>(myMap,w,position);
ch
.
start
();
float
vol
=
Algo
::
Geometry
::
Parallel
::
totalVolume
<
PFP
>
(
myMap
,
position
);
...
...
Apps/SandBox/CMakeLists.txt
View file @
3d4119e2
...
...
@@ -24,6 +24,9 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable
(
multi_att multi_att.cpp
)
target_link_libraries
(
multi_att
${
CGoGN_LIBS
}
${
CGoGN_EXT_LIBS
}
)
add_executable
(
trav3_test trav3_test.cpp
)
target_link_libraries
(
trav3_test
${
CGoGN_LIBS
}
${
CGoGN_EXT_LIBS
}
)
IF
(
WITH_QT
)
QT4_WRAP_CPP
(
tilings_moc tilings.h
)
add_executable
(
tilings tilings.cpp
${
tilings_moc
}
)
...
...
Apps/SandBox/trav3_test.cpp
0 → 100644
View file @
3d4119e2
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap3.h"
#include "Algo/Tiling/Volume/cubic.h"
#include "Utils/chrono.h"
using
namespace
CGoGN
;
/**
* Struct that contains some informations about the types of the manipulated objects
* Mainly here to be used by the algorithms that are parameterized by it
*/
struct
PFP
:
public
PFP_DOUBLE
{
// definition of the type of the map
typedef
EmbeddedMap3
MAP
;
};
// some typedef shortcuts
typedef
PFP
::
MAP
MAP
;
// map type
typedef
PFP
::
VEC3
VEC3
;
// type of R³ vector
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
localvolumeCentroidELW
(
typename
PFP
::
MAP
&
map
,
Vol
d
,
const
V_ATT
&
attributs
)
{
typedef
typename
V_ATT
::
DATA_TYPE
EMB
;
EMB
center
(
0.0
);
double
count
=
0.0
;
for
(
Edge
it
:
edgesIncidentToVolume3
(
map
,
d
))
{
EMB
e1
=
attributs
[
it
.
dart
];
EMB
e2
=
attributs
[
map
.
phi1
(
it
)];
double
l
=
(
e2
-
e1
).
norm
();
center
+=
(
e1
+
e2
)
*
l
;
count
+=
2.0
*
l
;
}
center
/=
double
(
count
);
return
center
;
}
int
main
()
{
// declare a map to handle the mesh
MAP
myMap
;
// add position attribute on vertices and get handler on it
VertexAttribute
<
VEC3
,
MAP
>
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
"position"
);
// create a topo grid of 4x4x4 squares
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
myMap
,
20
,
20
,
20
);
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
1.0
f
);
// easy way to find the central vertex of the grid
Vertex
v
;
foreach_cell_until
<
VERTEX
>
(
myMap
,
[
&
]
(
Vertex
it
)
{
if
(
position
[
it
]
==
VEC3
(
0
,
0
,
0
))
{
v
=
it
;
std
::
cout
<<
"Trouve"
<<
std
::
endl
;
return
false
;
}
return
true
;
});
// must test of find ok (if not v.dart is NIL)
if
(
!
v
.
valid
())
std
::
cerr
<<
"could not find a vertex with position (0,0,0)"
<<
std
::
endl
;
// WITH TRAVERSORS:
// find incident faces to vertex
Traversor3VF
<
MAP
>
trvf
(
myMap
,
v
.
dart
);
for
(
Dart
e
=
trvf
.
begin
();
e
!=
trvf
.
end
();
e
=
trvf
.
next
())
{
std
::
cout
<<
"Face of dart "
<<
e
<<
" incident to vertex of dart "
<<
v
.
dart
<<
std
::
endl
;
}
// find adjacent vertices thru a face
Traversor3VVaF
<
MAP
>
trvvaf
(
myMap
,
v
.
dart
);
for
(
Dart
e
=
trvvaf
.
begin
();
e
!=
trvvaf
.
end
();
e
=
trvvaf
.
next
())
{
std
::
cout
<<
"vertex of dart "
<<
e
<<
" adjacent to vertex of dart "
<<
v
.
dart
<<
" by a face"
<<
std
::
endl
;
}
// WITH FOREACH FUNCTION (C++11 lambda expression)
// find faces incident to vertex v
foreach_incident3
<
FACE
>
(
myMap
,
v
,
[
&
](
Face
f
)
{
std
::
cout
<<
"Face of dart "
<<
f
<<
" incident to vertex of dart "
<<
v
.
dart
<<
std
::
endl
;
});
// find vertices adjacent to vertex v thru a face
foreach_adjacent3
<
FACE
>
(
myMap
,
v
,
[
&
](
Vertex
x
)
{
std
::
cout
<<
"vertex of dart "
<<
x
<<
" adjacent to vertex of dart "
<<
v
.
dart
<<
" by a face"
<<
std
::
endl
;
});
// WITH FOR C++11 SYNTAX
for
(
Face
f
:
facesIncidentToVertex3
(
myMap
,
v
))
std
::
cout
<<
"Face of dart "
<<
f
<<
" incident to vertex of dart "
<<
v
.
dart
<<
std
::
endl
;
for
(
Vertex
x
:
verticesAdjacentByFace3
(
myMap
,
v
))
std
::
cout
<<
"vertex of dart "
<<
x
<<
" adjacent to vertex of dart "
<<
v
.
dart
<<
" by a face"
<<
std
::
endl
;
for
(
Vertex
v1
:
allVerticesOf
(
myMap
))
{
for
(
Vertex
v2
:
verticesAdjacentByEdge3
(
myMap
,
v1
))
{
for
(
Face
f
:
facesIncidentToVertex3
(
myMap
,
v2
))
if
((
f
.
dart
.
index
)
%
1000
==
1
)
std
::
cout
<<
"juste for fun face "
<<
f
<<
std
::
endl
;
}
}
Utils
::
Chrono
ch
;
VertexAttribute
<
VEC3
,
MAP
>
pos2
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
"pos2"
)
;
if
(
!
pos2
.
isValid
())
pos2
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
"pos2"
)
;
ch
.
start
();
for
(
int
i
=
0
;
i
<
20
;
++
i
)
{
VEC3
xx
(
0
,
0
,
0
);
int
nb
=
0
;
for
(
Vol
d
:
allVolumesOf
(
myMap
))
{
VEC3
vCentroid
=
localvolumeCentroidELW
<
PFP
>
(
myMap
,
d
,
position
)
;
xx
+=
vCentroid
;
nb
++
;
}
xx
/=
nb
;
std
::
cout
<<
xx
<<
std
::
endl
;
}
std
::
cout
<<
"for "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
ch
.
start
();
for
(
int
i
=
0
;
i
<
20
;
++
i
)
{
VEC3
xx
(
0
,
0
,
0
);
int
nb
=
0
;
foreach_cell
<
VOLUME
>
(
myMap
,
[
&
]
(
Vol
d
)
{
VEC3
vCentroid
=
Algo
::
Surface
::
Geometry
::
volumeCentroidELW
<
PFP
>
(
myMap
,
d
,
position
)
;
xx
+=
vCentroid
;
nb
++
;
});
xx
/=
nb
;
std
::
cout
<<
xx
<<
std
::
endl
;
}
std
::
cout
<<
"Lambda "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
return
0
;
}
Apps/Tuto/Attributes/multi_attribs.cpp
View file @
3d4119e2
...
...
@@ -80,6 +80,13 @@ void applySmooth(MAP& map, const ATT& att_in, ATT& att_out)
// check at compile if ATT is an AttributeHandler on orbit VERTEX
CHECK_ATTRIBUTEHANDLER_ORBIT
(
ATT
,
VERTEX
);
// or check at runtime(take care of const!)
if
(
!
checkAttributeHandlerOrbit
<
VERTEX
>
(
att_in
))
{
CGoGNerr
<<
"function applySmooth work only with VertexAttributes !"
<<
CGoGNendl
;
return
;
}
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
)
// for all vertex v of map do
{
att_out
[
v
]
=
smooth
(
map
,
v
,
att_in
);
...
...
Apps/Tuto/Attributes/simple_attribs.cpp
View file @
3d4119e2
...
...
@@ -125,6 +125,38 @@ void dumpAttribute(const ATTRIB& attr)
}
//function that apply on vertice with templated attribute type
template
<
typename
T
>
void
VertexTyped
(
MAP
&
map
,
T
&
va
)
{
// foreach_cell<VERTEX>(map,[&](Vertex v) // for all vertices
// {
// va[v] = 1.1 * va[v];
// });
// other syntax for traversal
for
(
Vertex
v
:
allVerticesOf
(
map
))
{
va
[
v
]
=
1.1
*
va
[
v
];
std
::
cout
<<
"V:"
<<
v
<<
" -> "
<<
va
[
v
]
<<
std
::
endl
;
}
}
// version that take a VertexAttribute, check type at runtime and call instancied template version
void
VertexGeneric
(
MAP
&
map
,
VertexAttributeGen
&
vg
)
{
auto
va3
=
dynamic_cast
<
VertexAttribute
<
VEC3
,
MAP
>*>
(
&
vg
);
if
(
va3
!=
NULL
)
return
VertexTyped
(
map
,
*
va3
);
auto
vaf
=
dynamic_cast
<
VertexAttribute
<
float
,
MAP
>*>
(
&
vg
);
if
(
vaf
!=
NULL
)
return
VertexTyped
(
map
,
*
vaf
);
}
int
main
()
{
// declare a map to handle the mesh
...
...
@@ -142,6 +174,8 @@ int main()
grid
.
embedIntoGrid
(
positionAtt
,
1.
,
1.
,
0.
);
VertexGeneric
(
myMap
,
positionAtt
);
// ATTRIBUTE DECLARATION
// add an attribute of type float on orbit EDGE
...
...
Apps/Tuto/Traversals/traverse_attributes.cpp
View file @
3d4119e2
...
...
@@ -63,7 +63,16 @@ int main()
{
std
::
cout
<<
id
<<
" : "
<<
position
[
id
]
<<
" / "
;
}
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
"--------------------------------"
<<
std
::
endl
;
//using (C++11 for syntax)
// warning: if you want ot modify the attributes do not forget the &
for
(
auto
&
p
:
position
.
iterable
())
{
p
*=
2.0
;
}
//using foreach function (C++11 lambda expression)
foreach_attribute
(
position
,
[
&
]
(
unsigned
int
id
)
// for each element of position
...
...
@@ -71,9 +80,11 @@ int main()
std
::
cout
<<
id
<<
" : "
<<
position
[
id
]
<<
" / "
;
});
std
::
cout
<<
std
::
endl
<<
"--------------------------------"
<<
std
::
endl
;
// using parallel foreach
// parameter position must be captured explicitly even if it used as first parameter of foreach !
Parallel
::
foreach_attribute
(
position
,
[
&
position
]
(
unsigned
int
id
,
unsigned
int
thread
)
// for each elt of the position attribute
Parallel
::
foreach_attribute
(
position
,
[
&
position
]
(
unsigned
int
id
,
unsigned
int
/*
thread
*/
)
// for each elt of the position attribute
{
position
[
id
]
*=
2.0
f
;
},
4
);
// 4:4 thread, false for no need for markers in threaded code.
...
...
Apps/Tuto/Traversals/traverse_cells.cpp
View file @
3d4119e2
...
...
@@ -111,17 +111,18 @@ int main()
});
// 4:4 thread, false for no need for markers in threaded code.
std
::
cout
<<
"After // processing"
<<
std
::
endl
;
foreach_cell
<
VERTEX
>
(
myMap
,
[
&
]
(
Vertex
v
)
// for each Vertex v of the MAP myMap
// last and simple traversal method (new for c++11 syntax)
for
(
Vertex
v
:
allVerticesOf
(
myMap
))
{
std
::
cout
<<
position
[
v
]
<<
" / "
;
}
);
}
std
::
cout
<<
std
::
endl
;
// Example with // accumulation
// computing the sum of area faces
// force number of threads to 4 (0 for traverse, 1,2,3 for computation)
CGoGN
::
Parallel
::
NumberOfThreads
=
4
;
...
...
@@ -137,6 +138,8 @@ int main()
std
::
cout
<<
surf
[
0
]
<<
"/"
<<
surf
[
1
]
<<
"/"
<<
surf
[
2
]
<<
"/"
<<
std
::
endl
;
std
::
cout
<<
"Total="
<<
surf
[
0
]
+
surf
[
1
]
+
surf
[
2
]
<<
std
::
endl
;
// example of traversal in two pass (optimizing marking/unmarking)
TraversorV
<
MAP
>
tv0
(
myMap
);
TraversorCellEven
<
MAP
,
VERTEX
>
tv1
(
tv0
);
TraversorCellOdd
<
MAP
,
VERTEX
>
tv2
(
tv0
);
...
...
Apps/Tuto/Traversals/traverse_neighbours.cpp
View file @
3d4119e2
...
...
@@ -102,5 +102,16 @@ int main()
std
::
cout
<<
"vertex of dart "
<<
x
<<
" adjacent to vertex of dart "
<<
v
.
dart
<<
" by a face"
<<
std
::
endl
;
});
// WITH FOR C++11 SYNTAX
for
(
Face
f
:
facesIncidentToVertex2
(
myMap
,
v
))
{
std
::
cout
<<
"Face of dart "
<<
f
<<
" incident to vertex of dart "
<<
v
.
dart
<<
std
::
endl
;
}
for
(
Vertex
x
:
verticesAdjacentByFace2
(
myMap
,
v
))
{
std
::
cout
<<
"vertex of dart "
<<
x
<<
" adjacent to vertex of dart "
<<
v
.
dart
<<
" by a face"
<<
std
::
endl
;
}
return
0
;
}
Apps/Tuto/tuto_dual3.cpp
View file @
3d4119e2
...
...
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
}
}
Dart
dcenter
=
myMap
.
explodBorderTopo
(
dsave
);
Dart
dcenter
=
myMap
.
explodBorderTopo
(
/*
dsave
*/
);
DartMarker
<
MAP
>
mf
(
myMap
);
for
(
Dart
dit
=
myMap
.
begin
()
;
dit
!=
myMap
.
end
()
;
myMap
.
next
(
dit
))
...
...
CMakeLists.txt
View file @
3d4119e2
...
...
@@ -143,7 +143,8 @@ IF (WITH_QT)
ADD_DEFINITIONS
(
${
QT_DEFINITIONS
}
)
find_package
(
QGLViewer REQUIRED
)
SET
(
CGoGN_EXT_INCLUDES
${
CGoGN_EXT_INCLUDES
}
${
QT_INCLUDE_DIR
}
${
QGLVIEWER_INCLUDE_DIR
}
)
SET
(
CGoGN_EXT_LIBS
${
QT_LIBRARIES
}
${
QGLVIEWER_LIBRARIES
}
${
CGoGN_EXT_LIBS
}
)
SET
(
CGoGN_EXT_LIBS
${
QGLVIEWER_LIBRARIES
}
${
QT_LIBRARIES
}
${
CGoGN_EXT_LIBS
}
)
ENDIF
(
WITH_QT
)
IF
(
WITH_GLEWMX
)
...
...
SCHNApps/include/cellSelector.h
View file @
3d4119e2
...
...
@@ -63,10 +63,10 @@ class CellSelector : public CellSelectorGen
typedef
CellSelector
<
MAP
,
ORBIT
>
SELECTOR
;
public:
CellSelector
(
MAP
&
map
,
const
QString
&
name
,
unsigned
int
thread
=
0
)
:
CellSelector
(
MAP
&
map
,
const
QString
&
name
)
:
CellSelectorGen
(
name
),
m_map
(
map
),
m_cm
(
map
,
thread
)
m_cm
(
map
)
{}
~
CellSelector
()
...
...
apps_cmake.txt
View file @
3d4119e2
...
...
@@ -26,7 +26,7 @@ file(STRINGS ${CGoGN_ROOT_DIR}/include/cgogn_onelib.h ONELIB_STR)
IF (ONELIB_STR EQUAL 1)
SET(CGoGN_LIBS cgogn)
ELSE()
SET(CGoGN_LIBS topology
algo
container utils)
SET(CGoGN_LIBS
algo
topology container utils)
ENDIF()
IF(WIN32)
...
...
include/Algo/Export/export.hpp
View file @
3d4119e2
...
...
@@ -392,9 +392,9 @@ bool exportOFF(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3,
out
.
close
()
;
return
true
;
}
/*
template
<
typename
PFP
>
bool exportOBJ(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename)
bool
exportOBJ
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
const
char
*
filename
)
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
VEC3
VEC3
;
...
...
@@ -416,7 +416,7 @@ bool exportOBJ(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>
std
::
vector
<
unsigned
int
>
vertices
;
vertices
.
reserve
(
nbDarts
/
6
)
;
CellMarker<VERTEX> markV(map) ;
CellMarker
<
typename
PFP
::
MAP
,
VERTEX
>
markV
(
map
)
;
TraversorF
<
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
...
...
@@ -425,7 +425,9 @@ bool exportOBJ(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>
Traversor2FV
<
typename
PFP
::
MAP
>
tfv
(
map
,
d
)
;
for
(
Dart
it
=
tfv
.
begin
();
it
!=
tfv
.
end
();
it
=
tfv
.
next
())
{
unsigned int vNum = map.getEmbedding(VERTEX, it) ;
// unsigned int vNum = map.getEmbedding(VERTEX, it) ;
unsigned
int
vNum
=
map
.
template
getEmbedding
<
VERTEX
>(
it
)
;
if
(
!
markV
.
isMarked
(
it
))
{
markV
.
mark
(
it
)
;
...
...
@@ -458,7 +460,7 @@ bool exportOBJ(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>
out
.
close
()
;
return
true
;
}
/*
template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename)
{
...
...
include/Algo/Geometry/area.h
View file @
3d4119e2
...
...
@@ -58,7 +58,7 @@ typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Face f, const VertexAt
//! @param position
//! @return
template
<
typename
PFP
>
typename
PFP
::
REAL
totalArea
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
unsigned
int
thread
=
0
)
;
typename
PFP
::
REAL
totalArea
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
)
;
//! \brief Compute the area of the faces around a vertex.
//! @param map
...
...
@@ -75,16 +75,16 @@ template <typename PFP>
typename
PFP
::
REAL
vertexVoronoiArea
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
)
;
template
<
typename
PFP
>
void
computeAreaFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
FaceAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
face_area
,
unsigned
int
thread
=
0
)
;
void
computeAreaFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
FaceAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
face_area
)
;
template
<
typename
PFP
>
void
computeOneRingAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertex_area
,
unsigned
int
thread
=
0
)
;
void
computeOneRingAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertex_area
)
;
template
<
typename
PFP
>
void
computeBarycentricAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertex_area
,
unsigned
int
thread
=
0
)
;
void
computeBarycentricAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertex_area
)
;
template
<
typename
PFP
>
void
computeVoronoiAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertex_area
,
unsigned
int
thread
=
0
)
;
void
computeVoronoiAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertex_area
)
;
namespace
Parallel
{
...
...
include/Algo/Geometry/area.hpp
View file @
3d4119e2
...
...
@@ -72,7 +72,7 @@ typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Face d, const VertexAt
}
template
<
typename
PFP
>
typename
PFP
::
REAL
totalArea
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
unsigned
int
thread
)
typename
PFP
::
REAL
totalArea
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
)
{
typename
PFP
::
REAL
area
(
0
)
;
...
...
@@ -80,7 +80,7 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typen
{
area
+=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
);
}
,
AUTO
,
thread
);
,
AUTO
);
return
area
;
}
...
...
@@ -137,10 +137,10 @@ typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, const Ver
}
template
<
typename
PFP
>
void
computeAreaFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
FaceAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
face_area
,
unsigned
int
thread
)
void
computeAreaFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
FaceAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
face_area
)
{
if
(
(
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
if
(
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
{
Parallel
::
computeAreaFaces
<
PFP
>
(
map
,
position
,
face_area
);
return
;
...
...
@@ -150,14 +150,14 @@ void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP
{
face_area
[
f
]
=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
)
;
}
,
AUTO
,
thread
);
,
AUTO
);
}
template
<
typename
PFP
>
void
computeOneRingAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertex_area
,
unsigned
int
thread
)
void
computeOneRingAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertex_area
)
{
if
(
(
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
if
(
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
{
Parallel
::
computeOneRingAreaVertices
<
PFP
>
(
map
,
position
,
vertex_area
);
return
;
...
...
@@ -174,14 +174,14 @@ void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty
vertex_area
[
v
]
+=
areas
[
f
];
});
}
,
FORCE_CELL_MARKING
,
thread
);
,
FORCE_CELL_MARKING
);
}
template
<
typename
PFP
>
void
computeBarycentricAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertex_area
,
unsigned
int
thread
)
void
computeBarycentricAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
vertex_area
)
{
if
(
(
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
if
(
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)