Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Hurstel
CGoGN
Commits
6ab5a4b4
Commit
6ab5a4b4
authored
Nov 08, 2011
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correctifs traversor2 + filters OK
parent
88f32610
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
70 deletions
+51
-70
include/Algo/Filtering/average_normals.h
include/Algo/Filtering/average_normals.h
+8
-2
include/Algo/Geometry/area.hpp
include/Algo/Geometry/area.hpp
+17
-33
include/Algo/Geometry/centroid.hpp
include/Algo/Geometry/centroid.hpp
+18
-27
include/Topology/generic/traversor2.h
include/Topology/generic/traversor2.h
+8
-8
No files found.
include/Algo/Filtering/average_normals.h
View file @
6ab5a4b4
...
...
@@ -356,14 +356,15 @@ void filterVNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con
long
nbAdapt
=
0
;
long
nbSusan
=
0
;
std
::
cout
<<
"compute new vertices normals.."
<<
std
::
endl
;
TraversorV
<
typename
PFP
::
MAP
>
tv
(
map
)
;
for
(
Dart
d
=
tv
.
begin
();
d
!=
tv
.
end
();
d
=
tv
.
next
())
{
if
(
select
(
d
))
if
(
select
(
d
))
{
const
VEC3
&
normV
=
normal
[
d
]
;
// traversal of neighbour vertices
REAL
sumArea
=
0
;
REAL
sigmaX2
=
0
;
REAL
sigmaY2
=
0
;
...
...
@@ -373,6 +374,7 @@ void filterVNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con
bool
SUSANregion
=
false
;
// traversal of neighbour vertices
Traversor2VVaE
<
typename
PFP
::
MAP
>
tav
(
map
,
d
)
;
for
(
Dart
it
=
tav
.
begin
();
it
!=
tav
.
end
();
it
=
tav
.
next
())
{
...
...
@@ -447,6 +449,8 @@ void filterVNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con
}
}
std
::
cout
<<
"update face normals.."
<<
std
::
endl
;
// Compute face normals from vertex normals
TraversorF
<
typename
PFP
::
MAP
>
tf
(
map
)
;
for
(
Dart
d
=
tf
.
begin
();
d
!=
tf
.
end
();
d
=
tf
.
next
())
...
...
@@ -469,6 +473,8 @@ void filterVNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con
}
}
std
::
cout
<<
"update vertices positions.."
<<
std
::
endl
;
// Compute new vertices position
computeNewPositionsFromFaceNormals
<
PFP
>
(
map
,
position
,
position2
,
faceArea
,
faceCentroid
,
faceNormal
,
faceNewNormal
,
select
...
...
include/Algo/Geometry/area.hpp
View file @
6ab5a4b4
...
...
@@ -95,12 +95,9 @@ template <typename PFP>
typename
PFP
::
REAL
vertexBarycentricArea
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
{
typename
PFP
::
REAL
area
(
0
)
;
Dart
it
=
d
;
do
{
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
;
it
=
map
.
alpha1
(
it
)
;
}
while
(
it
!=
d
)
;
return
area
;
}
...
...
@@ -108,8 +105,8 @@ template <typename PFP>
typename
PFP
::
REAL
vertexVoronoiArea
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
const
typename
PFP
::
TVEC3
&
position
)
{
typename
PFP
::
REAL
area
(
0
)
;
Dart
it
=
d
;
do
Traversor2VF
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
const
typename
PFP
::
VEC3
&
p1
=
position
[
it
]
;
const
typename
PFP
::
VEC3
&
p2
=
position
[
map
.
phi1
(
it
)]
;
...
...
@@ -128,64 +125,51 @@ typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Dart d, const typen
else
area
+=
tArea
/
4
;
}
it
=
map
.
alpha1
(
it
)
;
}
while
(
it
!=
d
)
;
}
return
area
;
}
template
<
typename
PFP
>
void
computeAreaFaces
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TREAL
&
face_area
,
const
FunctorSelect
&
select
)
{
CellMarker
marker
(
map
,
FACE
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
TraversorF
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
if
(
select
(
d
)
&&
!
marker
.
isMarked
(
d
))
{
marker
.
mark
(
d
);
if
(
select
(
d
))
face_area
[
d
]
=
convexFaceArea
<
PFP
>
(
map
,
d
,
position
)
;
}
}
}
template
<
typename
PFP
>
void
computeOneRingAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TREAL
&
vertex_area
,
const
FunctorSelect
&
select
)
{
CellMarker
marker
(
map
,
VERTEX
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
TraversorV
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
if
(
select
(
d
)
&&
!
marker
.
isMarked
(
d
))
{
marker
.
mark
(
d
);
if
(
select
(
d
))
vertex_area
[
d
]
=
vertexOneRingArea
<
PFP
>
(
map
,
d
,
position
)
;
}
}
}
template
<
typename
PFP
>
void
computeBarycentricAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TREAL
&
vertex_area
,
const
FunctorSelect
&
select
)
{
CellMarker
marker
(
map
,
VERTEX
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
TraversorV
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
if
(
select
(
d
)
&&
!
marker
.
isMarked
(
d
))
{
marker
.
mark
(
d
);
if
(
select
(
d
))
vertex_area
[
d
]
=
vertexBarycentricArea
<
PFP
>
(
map
,
d
,
position
)
;
}
}
}
template
<
typename
PFP
>
void
computeVoronoiAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TREAL
&
vertex_area
,
const
FunctorSelect
&
select
)
{
CellMarker
marker
(
map
,
VERTEX
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
TraversorV
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
if
(
select
(
d
)
&&
!
marker
.
isMarked
(
d
))
{
marker
.
mark
(
d
);
if
(
select
(
d
))
vertex_area
[
d
]
=
vertexVoronoiArea
<
PFP
>
(
map
,
d
,
position
)
;
}
}
}
...
...
include/Algo/Geometry/centroid.hpp
View file @
6ab5a4b4
...
...
@@ -22,6 +22,8 @@
* *
*******************************************************************************/
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
#include "Topology/generic/cellmarker.h"
namespace
CGoGN
...
...
@@ -98,13 +100,12 @@ EMB faceCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
{
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
unsigned
int
count
=
0
;
Dart
it
=
d
;
do
Traversor2FV
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
center
+=
attributs
[
it
];
++
count
;
it
=
map
.
phi1
(
it
)
;
}
while
(
it
!=
d
)
;
}
center
/=
double
(
count
);
return
center
;
}
...
...
@@ -114,13 +115,12 @@ EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& at
{
EMB
center
=
AttribOps
::
zero
<
EMB
,
PFP
>
();
unsigned
int
count
=
0
;
Dart
it
=
d
;
do
Traversor2VVaE
<
typename
PFP
::
MAP
>
t
(
map
,
d
)
;
for
(
Dart
it
=
t
.
begin
();
it
!=
t
.
end
();
it
=
t
.
next
())
{
center
+=
attributs
[
map
.
phi1
(
it
)
];
center
+=
attributs
[
it
];
++
count
;
it
=
map
.
alpha1
(
it
)
;
}
while
(
it
!=
d
)
;
}
center
/=
count
;
return
center
;
}
...
...
@@ -128,42 +128,33 @@ EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& at
template
<
typename
PFP
>
void
computeCentroidVolumes
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TVEC3
&
vol_centroid
,
const
FunctorSelect
&
select
)
{
CellMarker
marker
(
map
,
VOLUME
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
TraversorW
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
if
(
select
(
d
)
&&
!
marker
.
isMarked
(
d
))
{
marker
.
mark
(
d
);
if
(
select
(
d
))
vol_centroid
[
d
]
=
volumeCentroid
<
PFP
>
(
map
,
d
,
position
)
;
}
}
}
template
<
typename
PFP
>
void
computeCentroidFaces
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TVEC3
&
face_centroid
,
const
FunctorSelect
&
select
)
{
CellMarker
marker
(
map
,
FACE
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
TraversorF
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
if
(
select
(
d
)
&&
!
marker
.
isMarked
(
d
))
{
marker
.
mark
(
d
);
if
(
select
(
d
))
face_centroid
[
d
]
=
faceCentroid
<
PFP
>
(
map
,
d
,
position
)
;
}
}
}
template
<
typename
PFP
>
void
computeNeighborhoodCentroidVertices
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
typename
PFP
::
TVEC3
&
vertex_centroid
,
const
FunctorSelect
&
select
)
{
CellMarker
marker
(
map
,
VERTEX
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
TraversorV
<
typename
PFP
::
MAP
>
t
(
map
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
{
if
(
select
(
d
)
&&
!
marker
.
isMarked
(
d
))
{
marker
.
mark
(
d
);
if
(
select
(
d
))
vertex_centroid
[
d
]
=
vertexNeighborhoodCentroid
<
PFP
>
(
map
,
d
,
position
)
;
}
}
}
...
...
include/Topology/generic/traversor2.h
View file @
6ab5a4b4
...
...
@@ -72,15 +72,12 @@ private:
public:
Traversor2VF
(
MAP
&
map
,
Dart
dart
)
:
m
(
map
),
start
(
dart
)
{}
Dart
begin
()
{
current
=
start
;
if
(
m
.
isBoundaryMarked
(
current
))
// jump over a boundary face
current
=
m
.
alpha1
(
current
)
;
return
current
;
if
(
m
.
isBoundaryMarked
(
start
))
// jump over a boundary face
start
=
m
.
alpha1
(
start
)
;
}
Dart
begin
()
{
current
=
start
;
return
current
;
}
Dart
end
()
{
return
NIL
;
}
Dart
next
()
{
...
...
@@ -213,7 +210,10 @@ private:
public:
Traversor2EF
(
MAP
&
map
,
Dart
dart
)
:
m
(
map
),
start
(
dart
)
{}
{
if
(
m
.
isBoundaryMarked
(
start
))
start
=
m
.
phi2
(
current
)
;
}
Dart
begin
()
{
current
=
start
;
return
current
;
}
Dart
end
()
{
return
NIL
;
}
...
...
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