3#include <wmtk/TriMesh.h>
4#include <wmtk/envelope/Envelope.hpp>
58 template <
typename VertexAttributes>
59 bool init(
const TriMesh& m, VertexAttributes& vertex_attrs,
double eps,
bool use_exact)
61 std::vector<Eigen::Vector2i> E;
63 if (!m.is_boundary_edge(e))
continue;
64 const size_t a = e.vid(m), b = e.switch_vertex(m).vid(m);
65 E.emplace_back(
int(a), int(b));
66 vertex_attrs[a].input_boundary =
true;
67 vertex_attrs[b].input_boundary =
true;
70 m_initialized =
false;
73 std::vector<Eigen::Vector3d> V(m.vert_capacity());
74 for (
size_t i = 0; i < V.size(); ++i) {
75 V[i] = vertex_attrs[i].pos;
77 build(V, E, eps, use_exact);
89 void set_use_exact(
bool use_exact) { m_envelope.use_exact = use_exact; }
100 template <
typename VertexAttributes>
103 const VertexAttributes& vertex_attrs,
104 const std::vector<TriMesh::Tuple>& tris)
const
106 if (!m_initialized)
return true;
108 for (
int j = 0; j < 3; ++j) {
111 if (!vertex_attrs[a].input_boundary && !vertex_attrs[b].input_boundary)
continue;
112 if (!m.is_boundary_edge(e))
continue;
113 const std::array<Eigen::Vector3d, 2> seg{
114 {vertex_attrs[a].pos, vertex_attrs[b].pos}};
132 template <
typename VertexAttributes>
135 const VertexAttributes& vertex_attrs,
138 return vertex_attrs[v.
vid(m)].input_boundary && m.is_boundary_vertex(v);
143 const std::vector<Eigen::Vector3d>& V,
144 const std::vector<Eigen::Vector2i>& E,
149 bool m_initialized =
false;
A tube around the open boundary of a triangle mesh, for operations allowed to move it.
Definition BoundaryEnvelope.hpp:43
bool initialized() const
Whether init() found a boundary to build the tube around.
Definition BoundaryEnvelope.hpp:82
bool init(const TriMesh &m, VertexAttributes &vertex_attrs, double eps, bool use_exact)
Build the tube around the boundary edges of m and flag their vertices.
Definition BoundaryEnvelope.hpp:59
static bool on_input_boundary(const TriMesh &m, const VertexAttributes &vertex_attrs, const TriMesh::Tuple &v)
v is an input_boundary vertex that is still on the boundary.
Definition BoundaryEnvelope.hpp:133
bool boundary_edges_inside(const TriMesh &m, const VertexAttributes &vertex_attrs, const std::vector< TriMesh::Tuple > &tris) const
Every boundary edge of tris that touches an input_boundary vertex lies in the tube.
Definition BoundaryEnvelope.hpp:101
void set_use_exact(bool use_exact)
Definition BoundaryEnvelope.hpp:89
Definition Envelope.hpp:19
virtual bool is_outside(const std::array< Eigen::Vector3d, 3 > &tris) const
Definition Envelope.cpp:434
Tuple switch_vertex(const TriMesh &m) const
Definition TriMesh.cpp:161
size_t vid(const TriMesh &) const
Definition TriMesh.h:76