Skip to content
GitLab
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
56153d0f
Commit
56153d0f
authored
Jul 13, 2018
by
Philip Trettner
Browse files
poly fixes
parent
52e60aca
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/polymesh/algorithms/operations.hh
View file @
56153d0f
...
...
@@ -10,10 +10,26 @@
namespace
polymesh
{
/// Given a flat polymesh with convex faces, naively triangulates all faces
void
triangulate_naive
(
Mesh
&
m
);
// vertex_handle split(edge_handle e)
// {
// // TODO
// }
/// ======== IMPLEMENTATION ========
void
triangulate_naive
(
Mesh
&
m
)
{
std
::
vector
<
vertex_handle
>
vs
;
for
(
auto
f
:
m
.
faces
())
{
vs
=
f
.
vertices
().
to_vector
();
if
(
vs
.
size
()
<=
3
)
continue
;
// remove
m
.
faces
().
remove
(
f
);
// triangulate
for
(
auto
i
=
2u
;
i
<
vs
.
size
();
++
i
)
m
.
faces
().
add
(
vs
[
0
],
vs
[
1
],
vs
[
i
]);
}
}
}
src/polymesh/cursors.hh
View file @
56153d0f
...
...
@@ -28,6 +28,8 @@ struct primitive_index
bool
operator
==
(
index_t
const
&
rhs
)
const
{
return
value
==
rhs
.
value
;
}
bool
operator
!=
(
index_t
const
&
rhs
)
const
{
return
value
!=
rhs
.
value
;
}
bool
operator
==
(
handle_t
const
&
rhs
)
const
{
return
value
==
rhs
.
idx
.
value
;
}
bool
operator
!=
(
handle_t
const
&
rhs
)
const
{
return
value
!=
rhs
.
idx
.
value
;
}
/// indexes this primitive by a functor
/// also works for attributes
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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