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
294c2fa3
Commit
294c2fa3
authored
Aug 24, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
big bug in convexPolyhedronVolume (result was wrong)
parent
95bec210
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
include/Algo/Geometry/volume.hpp
include/Algo/Geometry/volume.hpp
+12
-7
No files found.
include/Algo/Geometry/volume.hpp
View file @
294c2fa3
...
@@ -73,6 +73,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
...
@@ -73,6 +73,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
std
::
vector
<
Dart
>
visitedFaces
;
std
::
vector
<
Dart
>
visitedFaces
;
visitedFaces
.
reserve
(
100
)
;
visitedFaces
.
reserve
(
100
)
;
visitedFaces
.
push_back
(
d
)
;
visitedFaces
.
push_back
(
d
)
;
mark
.
markOrbit
<
FACE
>
(
d
)
;
mark
.
markOrbit
<
FACE
>
(
d
)
;
...
@@ -104,7 +105,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
...
@@ -104,7 +105,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
if
(
!
mark
.
isMarked
(
ee
))
// not already marked
if
(
!
mark
.
isMarked
(
ee
))
// not already marked
{
{
visitedFaces
.
push_back
(
ee
)
;
visitedFaces
.
push_back
(
ee
)
;
mark
.
markOrbit
<
FACE
>
(
e
)
;
mark
.
markOrbit
<
FACE
>
(
e
e
)
;
}
}
e
=
map
.
phi1
(
e
)
;
e
=
map
.
phi1
(
e
)
;
}
while
(
e
!=
*
face
)
;
}
while
(
e
!=
*
face
)
;
...
@@ -117,11 +118,13 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
...
@@ -117,11 +118,13 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
template
<
typename
PFP
>
template
<
typename
PFP
>
typename
PFP
::
REAL
totalVolume
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
FunctorSelect
&
select
,
unsigned
int
thread
)
typename
PFP
::
REAL
totalVolume
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
FunctorSelect
&
select
,
unsigned
int
thread
)
{
{
typename
PFP
::
REAL
vol
=
0
;
// typename PFP::REAL vol = 0 ;
double
vol
=
0
;
TraversorW
<
typename
PFP
::
MAP
>
t
(
map
,
select
,
thread
)
;
TraversorW
<
typename
PFP
::
MAP
>
t
(
map
,
select
,
thread
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
vol
+=
convexPolyhedronVolume
<
PFP
>
(
map
,
d
,
position
,
thread
)
;
vol
+=
convexPolyhedronVolume
<
PFP
>
(
map
,
d
,
position
,
thread
)
;
return
vol
;
return
typename
PFP
::
REAL
(
vol
)
;
}
}
...
@@ -132,7 +135,8 @@ template <typename PFP>
...
@@ -132,7 +135,8 @@ template <typename PFP>
class
FunctorTotalVolume
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
class
FunctorTotalVolume
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
{
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
m_position
;
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
m_position
;
typename
PFP
::
REAL
m_vol
;
// typename PFP::REAL m_vol;
double
m_vol
;
public:
public:
FunctorTotalVolume
<
PFP
>
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
:
FunctorTotalVolume
<
PFP
>
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_vol
(
0.0
)
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_vol
(
0.0
)
...
@@ -143,7 +147,8 @@ public:
...
@@ -143,7 +147,8 @@ public:
m_vol
+=
convexPolyhedronVolume
<
PFP
>
(
this
->
m_map
,
d
,
m_position
,
threadID
)
;
m_vol
+=
convexPolyhedronVolume
<
PFP
>
(
this
->
m_map
,
d
,
m_position
,
threadID
)
;
}
}
typename
PFP
::
REAL
getVol
()
const
// typename PFP::REAL getVol() const
double
getVol
()
const
{
{
return
m_vol
;
return
m_vol
;
}
}
...
@@ -164,7 +169,7 @@ typename PFP::REAL totalVolume(typename PFP::MAP& map, const VertexAttribute<typ
...
@@ -164,7 +169,7 @@ typename PFP::REAL totalVolume(typename PFP::MAP& map, const VertexAttribute<typ
functs
.
push_back
(
new
FunctorTotalVolume
<
PFP
>
(
map
,
position
));
functs
.
push_back
(
new
FunctorTotalVolume
<
PFP
>
(
map
,
position
));
}
}
typename
PFP
::
REAL
total
=
0.0
;
double
total
=
0.0
;
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VOLUME
>
(
map
,
functs
,
nbth
,
true
,
select
,
current_thread
);
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VOLUME
>
(
map
,
functs
,
nbth
,
true
,
select
,
current_thread
);
...
@@ -173,7 +178,7 @@ typename PFP::REAL totalVolume(typename PFP::MAP& map, const VertexAttribute<typ
...
@@ -173,7 +178,7 @@ typename PFP::REAL totalVolume(typename PFP::MAP& map, const VertexAttribute<typ
total
+=
reinterpret_cast
<
FunctorTotalVolume
<
PFP
>*>
(
functs
[
i
])
->
getVol
();
total
+=
reinterpret_cast
<
FunctorTotalVolume
<
PFP
>*>
(
functs
[
i
])
->
getVol
();
delete
functs
[
i
];
delete
functs
[
i
];
}
}
return
total
;
return
typename
PFP
::
REAL
(
total
)
;
}
}
}
}
...
...
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