19 py::class_<HalfEdgeTriangleMesh::HalfEdge> half_edge(
21 "HalfEdge class contains vertex, triangle info about a half edge, "
22 "as well as relations of next and twin half edge.");
23 py::detail::bind_default_constructor<HalfEdgeTriangleMesh::HalfEdge>(
25 py::detail::bind_copy_functions<HalfEdgeTriangleMesh::HalfEdge>(half_edge);
29 std::ostringstream repr;
30 repr <<
"HalfEdge(vertex_indices {"
34 <<
", twin " << he.
twin_ <<
")";
38 "Returns ``True`` iff the half edge is the boundary (has not "
39 "twin, i.e. twin index == -1).")
42 "int: Index of the next HalfEdge in the same triangle.")
44 "int: Index of the twin HalfEdge")
48 "List(int) of length 2: Index of the ordered vertices "
49 "forming this half edge")
53 "int: Index of the triangle containing this half edge");
60 py::class_<HalfEdgeTriangleMesh, PyGeometry<HalfEdgeTriangleMesh>,
62 half_edge_triangle_mesh(
63 m,
"HalfEdgeTriangleMesh",
64 "HalfEdgeTriangleMesh inherits TriangleMesh class with the "
65 "addition of HalfEdge data structure for each half edge in "
66 "the mesh as well as related functions.");
67 py::detail::bind_default_constructor<HalfEdgeTriangleMesh>(
68 half_edge_triangle_mesh);
69 py::detail::bind_copy_functions<HalfEdgeTriangleMesh>(
70 half_edge_triangle_mesh);
71 half_edge_triangle_mesh
74 return std::string(
"HalfEdgeTriangleMesh with ") +
81 "``int`` array of shape ``(num_triangles, 3)``, use "
82 "``numpy.asarray()`` to access data: List of "
83 "triangles denoted by the index of points forming "
85 .def_readwrite(
"triangle_normals",
87 "``float64`` array of shape ``(num_triangles, 3)``, "
88 "use ``numpy.asarray()`` to access data: Triangle "
91 "Returns ``True`` if half-edges have already been computed.")
92 .def(
"boundary_half_edges_from_vertex",
95 "Query manifold boundary half edges from a starting vertex. "
96 "If query vertex is not on boundary, empty vector will be "
98 .def(
"boundary_vertices_from_vertex",
101 "Query manifold boundary vertices from a starting vertex. If "
102 "query vertex is not on boundary, empty vector will be "
105 "Returns a vector of boundaries. A boundary is a vector of "
107 .def_static(
"create_from_triangle_mesh",
109 "Convert HalfEdgeTriangleMesh from TriangleMesh. "
110 "Throws exception if "
111 "the input mesh is not manifolds")
113 "List of HalfEdge in the mesh")
115 "ordered_half_edge_from_vertex",
117 "Counter-clockwise ordered half-edges started from "
120 "boundary_half_edges_from_vertex");
122 "boundary_vertices_from_vertex");
128 "create_from_triangle_mesh",
129 {{
"mesh",
"The input TriangleMesh"}});
HalfEdge class contains vertex, triangle info about a half edge, as well as relations of next and twi...
int next_
Index of the next HalfEdge in the same triangle.
Eigen::Vector2i vertex_indices_
Index of the ordered vertices forming this half edge.
int triangle_index_
Index of the triangle containing this half edge.
int twin_
Index of the twin HalfEdge.
HalfEdgeTriangleMesh inherits TriangleMesh class with the addition of HalfEdge data structure for eac...
std::vector< int > boundaryVerticesFromVertex(int vertex_index) const
std::vector< int > boundaryHalfEdgesFromVertex(int vertex_index) const
std::vector< std::vector< int > > ordered_half_edge_from_vertex_
bool hasHalfEdges() const
Returns true if half-edges have already been computed.
static std::shared_ptr< HalfEdgeTriangleMesh > CreateFromTriangleMesh(const ccMesh &mesh)
std::vector< Eigen::Vector3i > triangles_
List of triangles in the mesh.
std::vector< HalfEdge > half_edges_
List of HalfEdge in the mesh.
std::vector< std::vector< int > > getBoundaries() const
Returns a vector of boundaries. A boundary is a vector of vertices.
std::vector< Eigen::Vector3d > triangle_normals_
List of triangle normals in the mesh.
std::vector< Eigen::Vector3d > vertices_
Vertex coordinates.
void ClassMethodDocInject(py::module &pybind_module, const std::string &class_name, const std::string &function_name, const std::unordered_map< std::string, std::string > &map_parameter_body_docs)
void pybind_half_edge(py::module &m)
void pybind_halfedgetrianglemesh(py::module &m)
Generic file read and write utility for python interface.
std::string to_string(const T &n)