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
1b75c483
Commit
1b75c483
authored
Mar 04, 2020
by
Philip Trettner
Browse files
added free functions for haldedge/edge find and exist
parent
c5f1a2d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/polymesh/algorithms/properties.hh
View file @
1b75c483
...
...
@@ -47,6 +47,19 @@ bool is_triangle(face_handle f);
/// returns true iff face is a quad
bool
is_quad
(
face_handle
f
);
/// returns the edge between two vertices
/// (returns invalid handle if edge not found)
/// (O(valence) running time)
edge_handle
edge_between
(
vertex_handle
v0
,
vertex_handle
v1
);
/// returns the halfedge between two vertices
/// (returns invalid handle if halfedge not found)
/// (O(valence) running time)
halfedge_handle
halfedge_from_to
(
vertex_handle
v_from
,
vertex_handle
v_to
);
/// returns true iff there is an edge between v0 and v1
bool
are_adjacent
(
vertex_handle
v0
,
vertex_handle
v1
);
/// returns true iff all faces are triangles
bool
is_triangle_mesh
(
Mesh
const
&
m
);
/// returns true iff all faces are quads
...
...
@@ -227,6 +240,30 @@ inline int valence(vertex_handle v) { return v.adjacent_vertices().size(); }
inline
bool
is_triangle
(
face_handle
f
)
{
return
f
.
halfedges
().
size
()
==
3
;
}
inline
bool
is_quad
(
face_handle
f
)
{
return
f
.
halfedges
().
size
()
==
4
;
}
inline
edge_handle
edge_between
(
vertex_handle
v0
,
vertex_handle
v1
)
{
for
(
auto
h
:
v0
.
outgoing_halfedges
())
if
(
h
.
vertex_to
()
==
v1
)
return
h
.
edge
();
return
{};
}
inline
halfedge_handle
halfedge_from_to
(
vertex_handle
v_from
,
vertex_handle
v_to
)
{
for
(
auto
h
:
v_from
.
outgoing_halfedges
())
if
(
h
.
vertex_to
()
==
v_to
)
return
h
;
return
{};
}
inline
bool
are_adjacent
(
vertex_handle
v0
,
vertex_handle
v1
)
{
for
(
auto
h
:
v0
.
outgoing_halfedges
())
if
(
h
.
vertex_to
()
==
v1
)
return
true
;
return
false
;
}
inline
bool
is_triangle_mesh
(
Mesh
const
&
m
)
{
return
m
.
faces
().
all
(
is_triangle
);
}
inline
bool
is_quad_mesh
(
Mesh
const
&
m
)
{
return
m
.
faces
().
all
(
is_quad
);
}
...
...
src/polymesh/ranges.hh
View file @
1b75c483
...
...
@@ -364,10 +364,10 @@ struct edge_collection : smart_collection<Mesh*, edge_tag, iterator>
/// Returns the edge handle between two vertices (invalid if not found)
/// O(valence) computation
edge_handle
find
(
vertex_handle
v_from
,
vertex_handle
v_to
)
const
;
[[
deprecated
(
"use pm::edge_between instead"
)]]
edge_handle
find
(
vertex_handle
v_from
,
vertex_handle
v_to
)
const
;
/// Returns true iff an edge exists between the vertices
/// O(valence) computation
bool
exists
(
vertex_handle
v_from
,
vertex_handle
v_to
)
const
;
[[
deprecated
(
"use pm::are_adjacent instead"
)]]
bool
exists
(
vertex_handle
v_from
,
vertex_handle
v_to
)
const
;
/// Splits this edge in half by inserting a vertex (which is returned)
/// Preserves face attributes
...
...
@@ -417,10 +417,10 @@ struct halfedge_collection : smart_collection<Mesh*, halfedge_tag, iterator>
/// Returns the half-edge handle between two vertices (invalid if not found)
/// O(valence) computation
halfedge_handle
find
(
vertex_handle
v_from
,
vertex_handle
v_to
)
const
;
[[
deprecated
(
"use pm::halfedge_from_to instead"
)]]
halfedge_handle
find
(
vertex_handle
v_from
,
vertex_handle
v_to
)
const
;
/// Returns true iff an edge exists between the vertices
/// O(valence) computation
bool
exists
(
vertex_handle
v_from
,
vertex_handle
v_to
)
const
;
[[
deprecated
(
"use pm::are_adjacent instead"
)]]
bool
exists
(
vertex_handle
v_from
,
vertex_handle
v_to
)
const
;
/// Collapsed the given half-edge by removing it, keeping the to_vertex, and creating new triangles
/// Preserves half-edge properties but not face or vertex ones
...
...
Philip Trettner
@ptrettner
mentioned in issue
#5 (closed)
·
Mar 04, 2020
mentioned in issue
#5 (closed)
mentioned in issue #5
Toggle commit list
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