Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Philip Trettner
polymesh
Commits
1054e254
Commit
1054e254
authored
Jun 27, 2018
by
Philip Trettner
Browse files
fixed find_halfedge
parent
c75078e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/polymesh/Mesh.cc
View file @
1054e254
#include
"Mesh.hh"
#include
<cassert>
#include
<map>
#include
<set>
#include
"debug.hh"
...
...
@@ -303,13 +305,19 @@ void Mesh::assert_consistency() const
// check derived counts
{
auto
v_e_sum
=
0
;
auto
f_h_sum
=
0
;
for
(
auto
v
:
valid_vertices
())
{
v_e_sum
+=
v
.
edges
().
size
();
}
for
(
auto
f
:
valid_faces
())
{
f_h_sum
+=
f
.
halfedges
().
size
();
}
assert
(
v_e_sum
==
2
*
size_valid_edges
());
// WRONG: assert(f_h_sum == size_valid_halfedges());
// TODO: more?
}
...
...
@@ -341,4 +349,15 @@ void Mesh::assert_consistency() const
assert
(
!
h
.
is_removed
());
}
}
// check half-edge uniqueness
std
::
map
<
int
,
std
::
set
<
int
>>
hes
;
for
(
auto
h
:
valid_halfedges
())
{
auto
v0
=
h
.
vertex_from
().
idx
.
value
;
auto
v1
=
h
.
vertex_to
().
idx
.
value
;
if
(
!
hes
[
v0
].
insert
(
v1
).
second
)
assert
(
false
&&
"duplicated half-edge"
);
}
}
src/polymesh/Mesh.hh
View file @
1054e254
...
...
@@ -791,7 +791,7 @@ inline halfedge_index Mesh::find_halfedge(vertex_index from, vertex_index to) co
return
he
;
// advance
he
=
opposite
(
h
.
next_halfedge
)
;
he
=
halfedge
(
opposite
(
h
e
))
.
next_halfedge
;
}
while
(
he
!=
he_begin
);
...
...
Write
Preview
Supports
Markdown
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