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
Thomas Pitiot
CGoGN
Commits
d2dd217b
Commit
d2dd217b
authored
Apr 25, 2014
by
Sylvain Thery
Browse files
foreach macro -> foreach function
parent
74edf8e4
Changes
13
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/volumeExplorer.cpp
View file @
d2dd217b
...
...
@@ -493,6 +493,14 @@ int main(int argc, char **argv)
Utils
::
Chrono
ch
;
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
);
std
::
cout
<<
"Compute Volume ->"
<<
std
::
endl
;
ch
.
start
();
float
vol
=
Algo
::
Geometry
::
totalVolume
<
PFP
>
(
myMap
,
position
);
...
...
Apps/SandBox/test_traversor2.cpp
View file @
d2dd217b
...
...
@@ -29,7 +29,6 @@
#include
"Algo/Import/import.h"
#include
"Algo/Export/export.h"
#include
"Topology/generic/cells_macros.h"
using
namespace
CGoGN
;
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -84,31 +83,18 @@ void MyQT::traversors(int x)
{
case
0
:
{
// TRAVERSE2_ADJACENT(VERTEX,EDGE,m_selected, b, MAP, myMap)
// m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
Vertex
v
(
m_selected
);
Edge
e
(
m_selected
);
fonct
(
v
);
fonct2
(
e
);
fonct
(
m_selected
);
v
=
m_selected
;
/*
Traversor2VVaE
<
MAP
>
trav
(
myMap
,
m_selected
);
for
(
Dart
b
=
trav
.
begin
();
b
!=
trav
.
end
();
b
=
trav
.
next
())
m_render_topo
->
setDartColor
(
b
,
0.0
f
,
1.0
f
,
0.0
f
);
*/
}
break
;
case
1
:
{
foreachAdjacent2
(
VERTEX
,
FACE
,
m_selected
,
b
,
MAP
,
myMap
)
m_render_topo
->
setDartColor
(
b
,
0.0
f
,
1.0
f
,
0.0
f
);
/*
Traversor2VVaF
<
MAP
>
trav
(
myMap
,
m_selected
);
for
(
Dart
b
=
trav
.
begin
();
b
!=
trav
.
end
();
b
=
trav
.
next
())
m_render_topo
->
setDartColor
(
b
,
0.0
f
,
1.0
f
,
0.0
f
);
*/
}
break
;
case
2
:
...
...
@@ -177,13 +163,9 @@ void MyQT::traversors(int x)
break
;
case
11
:
{
/*
Traversor2VF<MAP> trav(myMap,m_selected);
Traversor2VF
<
MAP
>
trav
(
myMap
,
m_selected
);
for
(
Dart
b
=
trav
.
begin
();
b
!=
trav
.
end
();
b
=
trav
.
next
())
m_render_topo
->
setDartColor
(
b
,
0.0
f
,
1.0
f
,
0.0
f
);
*/
foreachIncident2
(
VERTEX
,
m_selected
,
FACE
,
b
,
MAP
,
myMap
)
m_render_topo
->
setDartColor
(
b
,
0.0
f
,
1.0
f
,
0.0
f
);
}
break
;
default:
...
...
Apps/Tuto/Traversals/traverse_cells.cpp
View file @
d2dd217b
...
...
@@ -26,7 +26,6 @@
#include
"Topology/generic/parameters.h"
#include
"Topology/map/embeddedMap2.h"
#include
"Algo/Tiling/Surface/square.h"
#include
"Topology/generic/cells_macros.h"
using
namespace
CGoGN
;
...
...
@@ -102,9 +101,12 @@ int main()
std
::
cout
<<
std
::
endl
;
//using foreach macro
foreachCell
(
VERTEX
,
v
,
MAP
,
myMap
)
// for each Vertex v of the MAP myMap
//using foreach function (C++11 lambda expression)
foreach_cell
<
VERTEX
>
(
myMap
,[
&
](
Vertex
v
)
// for each Vertex v of the MAP myMap
{
std
::
cout
<<
v
<<
" : "
<<
position
[
v
]
<<
" / "
;
});
std
::
cout
<<
std
::
endl
;
// warning here v is a Vertex and not a Dart (but can cast automatically into)
...
...
Apps/Tuto/Traversals/traverse_neighbours.cpp
View file @
d2dd217b
...
...
@@ -26,7 +26,6 @@
#include
"Topology/generic/parameters.h"
#include
"Topology/map/embeddedMap2.h"
#include
"Algo/Tiling/Surface/square.h"
#include
"Topology/generic/cells_macros.h"
using
namespace
CGoGN
;
...
...
@@ -60,7 +59,12 @@ int main()
// easy way to find the central vertex of the grid
Vertex
v
;
findCell
(
VERTEX
,
v
,
MAP
,
myMap
,
position
[
v
]
==
VEC3
(
0
,
0
,
0
)
);
// findCell(VERTEX,v,MAP,myMap, position[v] == VEC3(0,0,0) );
find_cell
<
VERTEX
>
(
myMap
,
v
,
[
&
](
Vertex
v
)
{
return
position
[
v
]
==
VEC3
(
0
,
0
,
0
);
});
// 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
;
...
...
@@ -82,15 +86,19 @@ int main()
std
::
cout
<<
"vertex of dart "
<<
e
<<
" adjacent to vertex of dart "
<<
v
.
dart
<<
" by a face"
<<
std
::
endl
;
}
// WITH FOREACH
MACRO
// WITH FOREACH
FUNCTION (C++11 lambda expression)
// find incident faces to vertex
foreachIncident2
(
VERTEX
,
v
,
FACE
,
f
,
MAP
,
myMap
)
foreach_incident2
<
FACE
>
(
myMap
,
v
,[
&
](
Face
f
)
{
std
::
cout
<<
"Face of dart "
<<
f
<<
" incident to vertex of dart "
<<
v
.
dart
<<
std
::
endl
;
});
// find adjacent vertices thru a face
foreachAdjacent2
(
VERTEX
,
FACE
,
v
,
x
,
MAP
,
myMap
)
std
::
cout
<<
"vertex of dart "
<<
x
<<
" adjacent to vertex of dart "
<<
v
.
dart
<<
" by a face"
<<
std
::
endl
;
foreach_adjacent2
<
FACE
>
(
myMap
,
v
,[
&
](
Vertex
x
)
{
std
::
cout
<<
"vertex of dart "
<<
x
<<
" adjacent to vertex of dart "
<<
v
.
dart
<<
" by a face"
<<
std
::
endl
;
});
return
0
;
}
include/Algo/Geometry/area.h
View file @
d2dd217b
...
...
@@ -25,8 +25,6 @@
#ifndef __ALGO_GEOMETRY_AREA_H__
#define __ALGO_GEOMETRY_AREA_H__
#include
"Topology/generic/cells_macros.h"
namespace
CGoGN
{
...
...
include/Algo/Geometry/area.hpp
View file @
d2dd217b
...
...
@@ -25,7 +25,6 @@
#include
"Geometry/basic.h"
#include
"Algo/Geometry/centroid.h"
#include
"Topology/generic/cells_macros.h"
#include
"Topology/generic/autoAttributeHandler.h"
namespace
CGoGN
...
...
@@ -78,46 +77,48 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typen
typename
PFP
::
REAL
area
(
0
)
;
// TraversorF<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
// area += convexFaceArea<PFP>(map, d, position) ;
foreachCellMT
(
FACE
,
f
,
typename
PFP
::
MAP
,
map
,
thread
)
foreach_cell
<
FACE
>
(
map
,
[
&
]
(
Face
f
)
{
area
+=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
);
}
,
false
,
thread
);
return
area
;
}
template
<
typename
PFP
>
typename
PFP
::
REAL
vertexOneRingArea
(
typename
PFP
::
MAP
&
map
,
Vertex
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
typename
PFP
::
REAL
vertexOneRingArea
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
{
typename
PFP
::
REAL
area
(
0
)
;
// Traversor2VF<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
foreachIncident2
(
VERTEX
,
d
,
FACE
,
f
,
typename
PFP
::
MAP
,
map
)
foreach_incident2
<
FACE
>
(
map
,
v
,
[
&
]
(
Face
f
)
{
area
+=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
)
;
});
return
area
;
}
template
<
typename
PFP
>
typename
PFP
::
REAL
vertexBarycentricArea
(
typename
PFP
::
MAP
&
map
,
Vertex
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
typename
PFP
::
REAL
vertexBarycentricArea
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
{
typename
PFP
::
REAL
area
(
0
)
;
// Traversor2VF<typename PFP::MAP> t(map,
d
) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
// area += convexFaceArea<PFP>(map, it, position) / 3 ;
foreachIncident2
(
VERTEX
,
d
,
FACE
,
f
,
typename
PFP
::
MAP
,
map
)
// Traversor2VF<typename PFP::MAP> t(map,
v
) ;
foreach_incident2
<
FACE
>
(
map
,
v
,
[
&
]
(
Face
f
)
{
area
+=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
)
/
3
;
});
return
area
;
}
template
<
typename
PFP
>
typename
PFP
::
REAL
vertexVoronoiArea
(
typename
PFP
::
MAP
&
map
,
Vertex
d
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
typename
PFP
::
REAL
vertexVoronoiArea
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
{
typename
PFP
::
REAL
area
(
0
)
;
// Traversor2VF<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
foreachIncident2
(
VERTEX
,
d
,
FACE
,
it
,
typename
PFP
::
MAP
,
map
)
// Traversor2VF<typename PFP::MAP> t(map, v) ;
foreach_incident2
<
FACE
>
(
map
,
v
,
[
&
]
(
Face
it
)
{
const
typename
PFP
::
VEC3
&
p1
=
position
[
it
]
;
const
typename
PFP
::
VEC3
&
p2
=
position
[
map
.
phi1
(
it
)]
;
...
...
@@ -136,7 +137,7 @@ typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex d, const Ver
else
area
+=
tArea
/
4
;
}
}
}
);
return
area
;
}
...
...
@@ -146,28 +147,30 @@ void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP
// TraversorF<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
// face_area[d] = convexFaceArea<PFP>(map, d, position) ;
foreachCellMT
(
FACE
,
f
,
typename
PFP
::
MAP
,
map
,
thread
)
foreach_cell
<
FACE
>
(
map
,
[
&
]
(
Face
f
)
{
face_area
[
f
]
=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
)
;
}
,
false
,
thread
);
}
template
<
typename
PFP
>
void
computeOneRingAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertex_area
,
unsigned
int
thread
)
{
// TraversorV<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
// foreachCell(VERTEX,d,typename PFP::MAP,map,thread)
// vertex_area[d] = vertexOneRingArea<PFP>(map, d, position) ;
FaceAutoAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>
areas
(
map
);
computeAreaFaces
<
PFP
>
(
map
,
position
,
areas
);
foreachCellMT
(
VERTEX
,
v
,
typename
PFP
::
MAP
,
map
,
thread
)
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
)
{
vertex_area
[
v
]
=
typename
PFP
::
REAL
(
0
);
foreachIncident2
(
VERTEX
,
v
,
FACE
,
f
,
typename
PFP
::
MAP
,
map
)
foreach_incident2
<
FACE
>
(
map
,
v
,
[
&
]
(
Face
f
)
{
vertex_area
[
v
]
+=
areas
[
f
];
});
}
,
false
,
thread
);
}
...
...
@@ -175,18 +178,22 @@ template <typename PFP>
void
computeBarycentricAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertex_area
,
unsigned
int
thread
)
{
// TraversorV<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
foreachCellMT
(
VERTEX
,
d
,
typename
PFP
::
MAP
,
map
,
thread
)
vertex_area
[
d
]
=
vertexBarycentricArea
<
PFP
>
(
map
,
d
,
position
)
;
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
)
{
vertex_area
[
v
]
=
vertexBarycentricArea
<
PFP
>
(
map
,
v
,
position
)
;
}
,
false
,
thread
);
}
template
<
typename
PFP
>
void
computeVoronoiAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertex_area
,
unsigned
int
thread
)
{
// TraversorV<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
foreachCellMT
(
VERTEX
,
d
,
typename
PFP
::
MAP
,
map
,
thread
)
vertex_area
[
d
]
=
vertexVoronoiArea
<
PFP
>
(
map
,
d
,
position
)
;
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
)
{
vertex_area
[
v
]
=
vertexVoronoiArea
<
PFP
>
(
map
,
v
,
position
)
;
}
,
false
,
thread
);
}
...
...
include/Algo/Geometry/centroid.h
View file @
d2dd217b
...
...
@@ -26,7 +26,6 @@
#define __ALGO_GEOMETRY_CENTROID_H__
#include
"Geometry/basic.h"
#include
"Topology/generic/cells_macros.h"
namespace
CGoGN
{
...
...
include/Algo/Geometry/centroid.hpp
View file @
d2dd217b
...
...
@@ -28,7 +28,6 @@
#include
"Topology/generic/traversor/traversorCell.h"
#include
"Topology/generic/traversor/traversor3.h"
#include
"Algo/Parallel/parallel_foreach.h"
#include
"Topology/generic/cells_macros.h"
namespace
CGoGN
{
...
...
@@ -48,17 +47,13 @@ typename V_ATT::DATA_TYPE volumeCentroid(typename PFP::MAP& map, Vol d, const V_
typename
V_ATT
::
DATA_TYPE
center
(
0.0
);
unsigned
int
count
=
0
;
// Traversor3WV<typename PFP::MAP> tra(map,d,false,thread);
// for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
// {
// center += attributs[d];
// ++count;
// }
foreach
I
ncident3
MT
(
VOLUME
,
d
,
VERTEX
,
e
,
typename
PFP
::
MAP
,
map
,
thread
)
foreach
_i
ncident3
<
VERTEX
>
(
map
,
d
,
[
&
]
(
Vertex
v
)
{
center
+=
attributs
[
e
];
center
+=
attributs
[
v
];
++
count
;
}
,
false
,
thread
);
center
/=
double
(
count
)
;
return
center
;
...
...
@@ -72,9 +67,7 @@ typename V_ATT::DATA_TYPE volumeCentroidELW(typename PFP::MAP& map, Vol d, const
double
count
=
0.0
;
// Traversor3WE<typename PFP::MAP> t(map, d,false,thread) ;
// for(Dart it = t.begin(); it != t.end();it = t.next())
// foreachIncident3MT(VOLUME,d,EDGE,it,typename PFP::MAP,map,thread)
foreach_incident3
<
EDGE
>
(
map
,
d
,
[
&
]
(
Edge
it
)
{
EMB
e1
=
attributs
[
it
.
dart
];
...
...
@@ -94,8 +87,6 @@ typename V_ATT::DATA_TYPE faceCentroid(typename PFP::MAP& map, Face f, const V_A
unsigned
int
count
=
0
;
// Traversor2FV<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
// foreachIncident2(FACE,d,VERTEX,it,typename PFP::MAP,map)
foreach_incident2
<
VERTEX
>
(
map
,
f
,
[
&
](
Vertex
it
)
{
...
...
@@ -107,7 +98,7 @@ typename V_ATT::DATA_TYPE faceCentroid(typename PFP::MAP& map, Face f, const V_A
}
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
faceCentroidELW
(
typename
PFP
::
MAP
&
map
,
Face
d
,
const
V_ATT
&
attributs
)
typename
V_ATT
::
DATA_TYPE
faceCentroidELW
(
typename
PFP
::
MAP
&
map
,
Face
f
,
const
V_ATT
&
attributs
)
{
typedef
typename
V_ATT
::
DATA_TYPE
EMB
;
...
...
@@ -115,32 +106,31 @@ typename V_ATT::DATA_TYPE faceCentroidELW(typename PFP::MAP& map, Face d, const
double
count
=
0.0
;
// Traversor2FE<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
foreach
I
ncident2
(
FACE
,
d
,
EDGE
,
it
,
typename
PFP
::
MAP
,
map
)
foreach
_i
ncident2
<
EDGE
>
(
map
,
f
,
[
&
](
Edge
it
)
{
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
;
}
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
vertexNeighborhoodCentroid
(
typename
PFP
::
MAP
&
map
,
Vertex
d
,
const
V_ATT
&
attributs
)
typename
V_ATT
::
DATA_TYPE
vertexNeighborhoodCentroid
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
V_ATT
&
attributs
)
{
typename
V_ATT
::
DATA_TYPE
center
(
0.0
);
unsigned
int
count
=
0
;
// Traversor2VVaE<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
foreachAdjacent2
(
VERTEX
,
EDGE
,
d
,
it
,
typename
PFP
::
MAP
,
map
)
foreach_adjacent2
<
EDGE
>
(
map
,
v
,
[
&
](
Vertex
it
)
{
center
+=
attributs
[
it
];
++
count
;
}
}
);
center
/=
count
;
return
center
;
}
...
...
@@ -148,28 +138,31 @@ typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Ver
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
void
computeCentroidFaces
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
face_centroid
,
unsigned
int
thread
)
{
// TraversorF<typename PFP::MAP> t(map,thread) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
foreachCellMT
(
FACE
,
d
,
typename
PFP
::
MAP
,
map
,
thread
)
face_centroid
[
d
]
=
faceCentroid
<
PFP
,
V_ATT
>
(
map
,
d
,
position
)
;
foreach_cell
<
FACE
>
(
map
,
[
&
]
(
Face
f
)
{
face_centroid
[
f
]
=
faceCentroid
<
PFP
,
V_ATT
>
(
map
,
f
,
position
)
;
}
,
false
,
thread
);
}
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
void
computeCentroidELWFaces
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
face_centroid
,
unsigned
int
thread
)
{
// TraversorF<typename PFP::MAP> t(map,thread) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
foreachCellMT
(
FACE
,
d
,
typename
PFP
::
MAP
,
map
,
thread
)
face_centroid
[
d
]
=
faceCentroidELW
<
PFP
,
V_ATT
>
(
map
,
d
,
position
)
;
foreach_cell
<
FACE
>
(
map
,
[
&
]
(
Face
f
)
{
face_centroid
[
f
]
=
faceCentroidELW
<
PFP
,
V_ATT
>
(
map
,
f
,
position
)
;
}
,
false
,
thread
);
}
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNeighborhoodCentroidVertices
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
V_ATT
&
vertex_centroid
,
unsigned
int
thread
)
{
// TraversorV<typename PFP::MAP> t(map, thread) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
foreachCellMT
(
VERTEX
,
d
,
typename
PFP
::
MAP
,
map
,
thread
)
vertex_centroid
[
d
]
=
vertexNeighborhoodCentroid
<
PFP
,
V_ATT
>
(
map
,
d
,
position
)
;
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
)
{
vertex_centroid
[
v
]
=
vertexNeighborhoodCentroid
<
PFP
,
V_ATT
>
(
map
,
v
,
position
)
;
}
,
false
,
thread
);
}
...
...
@@ -267,17 +260,19 @@ namespace Geometry
{
template
<
typename
PFP
,
typename
V_ATT
>
typename
V_ATT
::
DATA_TYPE
vertexNeighborhoodCentroid
(
typename
PFP
::
MAP
&
map
,
Vertex
d
,
const
V_ATT
&
attributs
,
unsigned
int
thread
)
typename
V_ATT
::
DATA_TYPE
vertexNeighborhoodCentroid
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
V_ATT
&
attributs
,
unsigned
int
thread
)
{
typename
V_ATT
::
DATA_TYPE
center
(
0.0
);
unsigned
int
count
=
0
;
// Traversor3VVaE<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
foreachAdjacent3MT
(
VERTEX
,
EDGE
,
d
,
it
,
typename
PFP
::
MAP
,
map
,
thread
)
// foreachAdjacent3MT(VERTEX,EDGE,d,it,typename PFP::MAP,map,thread)
foreach_adjacent3
<
EDGE
>
(
map
,
v
,
[
&
](
Vertex
it
)
{
center
+=
attributs
[
it
];
++
count
;
}
,
false
,
thread
);
center
/=
count
;
return
center
;
}
...
...
@@ -287,8 +282,12 @@ void computeCentroidVolumes(typename PFP::MAP& map, const V_ATT& position, W_ATT
{
// TraversorW<typename PFP::MAP> t(map, thread) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
foreachCellMT
(
VOLUME
,
d
,
typename
PFP
::
MAP
,
map
,
thread
)
vol_centroid
[
d
]
=
Surface
::
Geometry
::
volumeCentroid
<
PFP
,
V_ATT
>
(
map
,
d
,
position
,
thread
)
;
// foreachCellMT(VOLUME,d,typename PFP::MAP,map ,thread)
foreach_cell
<
VOLUME
>
(
map
,
[
&
]
(
Vol
v
)
{
vol_centroid
[
v
]
=
Surface
::
Geometry
::
volumeCentroid
<
PFP
,
V_ATT
>
(
map
,
v
,
position
,
thread
)
;
}
,
false
,
thread
);
}
template
<
typename
PFP
,
typename
V_ATT
,
typename
W_ATT
>
...
...
@@ -296,8 +295,12 @@ void computeCentroidELWVolumes(typename PFP::MAP& map, const V_ATT& position, W_
{
// TraversorW<typename PFP::MAP> t(map,thread) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
foreachCellMT
(
VOLUME
,
d
,
typename
PFP
::
MAP
,
map
,
thread
)
vol_centroid
[
d
]
=
Surface
::
Geometry
::
volumeCentroidELW
<
PFP
,
V_ATT
>
(
map
,
d
,
position
,
thread
)
;
// foreachCellMT(VOLUME,d,typename PFP::MAP,map ,thread)
foreach_cell
<
VOLUME
>
(
map
,
[
&
]
(
Vol
v
)
{
vol_centroid
[
v
]
=
Surface
::
Geometry
::
volumeCentroidELW
<
PFP
,
V_ATT
>
(
map
,
v
,
position
,
thread
)
;
}
,
false
,
thread
);
}
template
<
typename
PFP
,
typename
V_ATT
>
...
...
@@ -305,8 +308,12 @@ void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& po
{
// TraversorV<typename PFP::MAP> t(map, thread) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
foreachCellMT
(
VERTEX
,
d
,
typename
PFP
::
MAP
,
map
,
thread
)
vertex_centroid
[
d
]
=
Volume
::
Geometry
::
vertexNeighborhoodCentroid
<
PFP
,
V_ATT
>
(
map
,
d
,
position
)
;
// foreachCellMT(VERTEX,d,typename PFP::MAP,map ,thread)
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
)
{
vertex_centroid
[
v
]
=
Volume
::
Geometry
::
vertexNeighborhoodCentroid
<
PFP
,
V_ATT
>
(
map
,
v
,
position
)
;
}
,
false
,
thread
);
}
...
...
include/Algo/Render/GL2/explodeVolumeRender.hpp
View file @
d2dd217b
...
...
@@ -171,8 +171,7 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const V_ATT& posi
vertices
.
reserve
(
20
);
// TraversorCell<MAP, MAP::FACE_OF_PARENT> traFace(map);
// for (Dart d = traFace.begin(); d != traFace.end(); d = traFace.next())
foreachCell
(
MAP
::
FACE_OF_PARENT
,
d
,
MAP
,
map
)
foreach_cell
<
MAP
::
FACE_OF_PARENT
>
(
map
,
[
&
]
(
Cell
<
MAP
::
FACE_OF_PARENT
>
d
)
{
// compute normals
VEC3
centerFace
=
Algo
::
Surface
::
Geometry
::
faceCentroidELW
<
PFP
>
(
map
,
d
.
dart
,
positions
);
...
...
@@ -229,8 +228,8 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const V_ATT& posi
bufferColors
.
push_back
(
volCol
);
}
}
}
}
);
// ,false,thread); ????
m_nbTris
=
buffer
.
size
()
/
4
;
...
...
@@ -255,13 +254,13 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const V_ATT& posi
buffer
.
clear
();
// TraversorCell<typename PFP::MAP, PFP::MAP::EDGE_OF_PARENT> traEdge(map);
// for (Dart d = traEdge.begin(); d != traEdge.end(); d = traEdge.next())
foreachCell
(
MAP
::
EDGE_OF_PARENT
,
d
,
MAP
,
map
)
foreach_cell
<
PFP
::
MAP
::
EDGE_OF_PARENT
>
(
map
,
[
&
]
(
Cell
<
PFP
::
MAP
::
EDGE_OF_PARENT
>
c
)
{
buffer
.
push_back
(
PFP
::
toVec3f
(
centerVolumes
[
d
.
dart
]));
buffer
.
push_back
(
PFP
::
toVec3f
(
positions
[
d
.
dart
]));
buffer
.
push_back
(
PFP
::
toVec3f
(
positions
[
map
.
phi1
(
d
)]));
}
buffer
.
push_back
(
PFP
::
toVec3f
(
centerVolumes
[
c
.
dart
]));
buffer
.
push_back
(
PFP
::
toVec3f
(
positions
[
c
.
dart
]));
buffer
.
push_back
(
PFP
::
toVec3f
(
positions
[
map
.
phi1
(
c
)]));
});
// ,false,thread); ????
m_nbLines
=
buffer
.
size
()
/
3
;
...
...
@@ -308,7 +307,7 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const EMBV& posit
// TraversorCell<MAP, MAP::FACE_OF_PARENT> traFace(map);
// for (Dart d = traFace.begin(); d != traFace.end(); d = traFace.next())
foreach
C
ell
(
MAP
::
FACE_OF_PARENT
,
d
,
MAP
,
map
)
foreach
_c
ell
<
MAP
::
FACE_OF_PARENT
>
(
map
,
[
&
]
(
Cell
<
MAP
::
FACE_OF_PARENT
>
d
)
{
// compute normals
VEC3
centerFace
=
Algo
::
Surface
::
Geometry
::
faceCentroidELW
<
PFP
>
(
map
,
d
,
positions
);
...
...
@@ -363,7 +362,7 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const EMBV& posit
bufferColors
.
push_back
(
m_globalColor
);
}
}
}
}
);
// false,thread) ???
m_nbTris
=
buffer
.
size
()
/
4
;
...
...
@@ -389,12 +388,12 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const EMBV& posit
// TraversorCell<typename PFP::MAP, PFP::MAP::EDGE_OF_PARENT> traEdge(map);
// for (Dart d = traEdge.begin(); d != traEdge.end(); d = traEdge.next())
foreach
C
ell
(
MAP
::
EDGE_OF_PARENT
,
d
,
MAP
,
map
)
foreach
_c
ell
<
MAP
::
EDGE_OF_PARENT
>
(
map
,
[
&
]
(
Cell
<
MAP
::
EDGE_OF_PARENT
>
c
)
{
buffer
.
push_back
(
PFP
::
toVec3f
(
centerVolumes
[
d
]));
buffer
.
push_back
(
PFP
::
toVec3f
(
positions
[
d
]));
buffer
.
push_back
(
PFP
::
toVec3f
(
positions
[
map
.
phi1
(
d
)]));
}
buffer
.
push_back
(
PFP
::
toVec3f
(
centerVolumes
[
c
.
dart
]));
buffer
.
push_back
(
PFP
::
toVec3f
(
positions
[
c
.
dart
]));
buffer
.
push_back
(
PFP
::
toVec3f
(
positions
[
map
.
phi1
(
c
.
dart
)]));
}
);
m_nbLines
=
buffer
.
size
()
/
3
;
...
...
@@ -450,8 +449,7 @@ void ExplodeVolumeRender::updateData(typename PFP::MAP& map, const V_ATT& positi
bufferColors
.
reserve
(
16384
);
// TraversorCell<MAP, MAP::FACE_OF_PARENT> traFace(map);
// for (Dart d = traFace.begin(); d != traFace.end(); d = traFace.next())
foreachCell
(
MAP
::
FACE_OF_PARENT
,
d
,
MAP
,
map
)
foreach_cell
<
MAP
::
FACE_OF_PARENT
>
(
map
,
[
&
]
(
Cell
<
MAP
::
FACE_OF_PARENT
>
d
)
{
VEC3F
centerFace
=
PFP
::
toVec3f
(
Algo
::
Surface
::
Geometry
::
faceCentroidELW
<
PFP
>
(
map
,
d
.
dart
,
positions
));
VEC3F
volColor
=
PFP