Commit 56153d0f authored by Philip Trettner's avatar Philip Trettner
Browse files

poly fixes

parent 52e60aca
...@@ -10,10 +10,26 @@ ...@@ -10,10 +10,26 @@
namespace polymesh namespace polymesh
{ {
/// Given a flat polymesh with convex faces, naively triangulates all faces
void triangulate_naive(Mesh& m);
// vertex_handle split(edge_handle e) /// ======== IMPLEMENTATION ========
// {
// // TODO
// }
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]);
}
}
} }
...@@ -28,6 +28,8 @@ struct primitive_index ...@@ -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!=(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 /// indexes this primitive by a functor
/// also works for attributes /// also works for attributes
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment