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
Hurstel
CGoGN
Commits
9a7fe051
Commit
9a7fe051
authored
Jan 25, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use TraversorWV for volumeCentroid , factor 10 optimization !!
parent
6ae8656b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
46 deletions
+6
-46
include/Algo/Geometry/centroid.hpp
include/Algo/Geometry/centroid.hpp
+6
-46
No files found.
include/Algo/Geometry/centroid.hpp
View file @
9a7fe051
...
...
@@ -25,6 +25,9 @@
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
#include "Topology/generic/cellmarker.h"
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor3.h"
namespace
CGoGN
{
...
...
@@ -41,54 +44,11 @@ EMB volumeCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
()
;
unsigned
count
=
0
;
// CellMarkerStore marker(map, VERTEX) ;
//
// std::vector<Dart> visitedVertices ;
// visitedVertices.reserve(100) ;
// visitedVertices.push_back(d) ;
// marker.mark(d) ;
//
// for(typename std::vector<Dart>::iterator vert = visitedVertices.begin(); vert != visitedVertices.end(); ++vert)
// {
// Dart e = *vert;
// center += attributs[e]; // add to center and mark
// ++count;
// do // add all vertex neighbors to the table
// {
// Dart ee = map.phi2(e) ;
// if(!marker.isMarked(ee))
// {
// visitedVertices.push_back(ee) ;
// marker.mark(e) ;
// }
// e = map.phi1(ee) ;
// } while(e != *vert) ;
// }
DartMarkerStore
mark
(
map
);
// Lock a marker
std
::
vector
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
reserve
(
128
);
visitedFaces
.
push_back
(
d
);
// Start with the face of d
mark
.
markOrbit
(
VERTEX
,
d
)
;
for
(
unsigned
int
i
=
0
;
i
<
visitedFaces
.
size
();
++
i
)
Traversor3WV
<
typename
PFP
::
MAP
>
tra
(
map
,
d
);
for
(
Dart
d
=
tra
.
begin
();
d
!=
tra
.
end
();
d
=
tra
.
next
())
{
Dart
e
=
visitedFaces
[
i
]
;
center
+=
attributs
[
e
];
// add to center and mark
center
+=
attributs
[
d
];
++
count
;
do
// add all face neighbours to the table
{
Dart
ee
=
map
.
phi2
(
e
)
;
if
(
!
mark
.
isMarked
(
ee
))
// not already marked
{
visitedFaces
.
push_back
(
ee
)
;
mark
.
markOrbit
(
VERTEX
,
ee
)
;
}
e
=
map
.
phi1
(
e
)
;
}
while
(
e
!=
visitedFaces
[
i
])
;
}
center
/=
double
(
count
)
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment