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
2847632a
Commit
2847632a
authored
Jul 03, 2018
by
Philip Trettner
Browse files
added splits
parent
726f7017
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/polymesh/impl/impl_mesh.hh
View file @
2847632a
...
...
@@ -532,8 +532,8 @@ inline halfedge_index Mesh::prev_valid_idx_from(halfedge_index idx) const
inline
void
Mesh
::
connect_prev_next
(
halfedge_index
prev
,
halfedge_index
next
)
{
auto
&
prev_ref
=
halfedge
(
prev
);
auto
&
next_ref
=
halfedge
(
next
);
auto
&
prev_ref
=
halfedge
(
prev
);
auto
&
next_ref
=
halfedge
(
next
);
prev_ref
.
next_halfedge
=
next
;
next_ref
.
prev_halfedge
=
prev
;
...
...
@@ -628,12 +628,18 @@ inline vertex_index Mesh::edge_split(edge_index e)
v1_ref
.
outgoing_halfedge
=
e2h0
;
// rewire faces
auto
&
f0_ref
=
face
(
f0
);
auto
&
f1_ref
=
face
(
f1
);
if
(
f0_ref
.
halfedge
==
h0
)
f0_ref
.
halfedge
=
e1h0
;
if
(
f1_ref
.
halfedge
==
h1
)
f1_ref
.
halfedge
=
e2h1
;
if
(
f0
.
is_valid
())
{
auto
&
f0_ref
=
face
(
f0
);
if
(
f0_ref
.
halfedge
==
h0
)
f0_ref
.
halfedge
=
e1h0
;
}
if
(
f1
.
is_valid
())
{
auto
&
f1_ref
=
face
(
f1
);
if
(
f1_ref
.
halfedge
==
h1
)
f1_ref
.
halfedge
=
e2h1
;
}
// remove edge
h0_ref
.
set_removed
();
...
...
@@ -646,12 +652,55 @@ inline vertex_index Mesh::edge_split(edge_index e)
inline
vertex_index
Mesh
::
halfedge_split
(
halfedge_index
h
)
{
// add vertex
// add vertex and edge
auto
v
=
add_vertex
();
auto
e
=
alloc_edge
();
auto
h0
=
h
;
auto
h1
=
opposite
(
h
);
auto
h2
=
halfedge_of
(
e
,
0
);
auto
h3
=
halfedge_of
(
e
,
1
);
auto
v0
=
halfedge
(
h0
).
to_vertex
;
auto
v1
=
halfedge
(
h1
).
to_vertex
;
// rewire edges
auto
&
h0_ref
=
halfedge
(
h0
);
auto
&
h1_ref
=
halfedge
(
h1
);
auto
&
h2_ref
=
halfedge
(
h2
);
auto
&
h3_ref
=
halfedge
(
h3
);
// add new half-edge
auto
h0_next
=
h0_ref
.
next_halfedge
;
auto
h1_prev
=
h1_ref
.
prev_halfedge
;
auto
f0
=
h0_ref
.
face
;
auto
f1
=
h1_ref
.
face
;
h2_ref
.
face
=
f0
;
h3_ref
.
face
=
f1
;
h0_ref
.
to_vertex
=
v
;
h1_ref
.
to_vertex
=
v1
;
//< already there
h2_ref
.
to_vertex
=
v0
;
h3_ref
.
to_vertex
=
v
;
connect_prev_next
(
h0
,
h2
);
connect_prev_next
(
h2
,
h0_next
);
assert
(
0
&&
"not implemented"
);
return
{};
connect_prev_next
(
h1_prev
,
h3
);
connect_prev_next
(
h3
,
h1
);
// rewire vertices
auto
&
v0_ref
=
vertex
(
v0
);
if
(
v0_ref
.
outgoing_halfedge
==
h1
)
v0_ref
.
outgoing_halfedge
=
h3
;
vertex
(
v
).
outgoing_halfedge
=
h1_ref
.
is_free
()
?
h1
:
h2
;
// boundary
// rewire faces
// -> already ok
return
v
;
}
inline
void
Mesh
::
vertex_collapse
(
vertex_handle
v
)
const
{
assert
(
0
&&
"not implemented"
);
}
...
...
src/polymesh/ranges.hh
View file @
2847632a
...
...
@@ -251,7 +251,7 @@ struct halfedge_collection : smart_collection<Mesh*, halfedge_tag, iterator>
/// Splits this half-edge in half by inserting a vertex (which is returned)
/// Preserves face attributes
/// Contra
t
y to edges().split, the edge is preserved and a single new one is inserted AFTER h
/// Contra
r
y to edges().split, the edge is preserved and a single new one is inserted AFTER h
/// (thus h->next() is the newly inserted edge and h->vertex_to() is the returned vertex)
vertex_handle
split
(
halfedge_handle
h
)
const
;
...
...
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