11#ifndef EASY3D_ALGO_SURFACE_MESH_COMPONENTS_H
12#define EASY3D_ALGO_SURFACE_MESH_COMPONENTS_H
16#include <easy3d/core/surface_mesh.h>
70 const std::vector<Face> &
faces()
const {
return faces_; }
76 const std::vector<Vertex> &
vertices()
const {
return vertices_; }
82 const std::vector<Edge> &
edges()
const {
return edges_; }
88 const std::vector<Halfedge> &
halfedges()
const {
return halfedges_; }
94 std::size_t
n_faces()
const {
return faces_.size(); }
106 std::size_t
n_edges()
const {
return edges_.size(); }
153 std::vector<Face> faces_;
154 std::vector<Vertex> vertices_;
155 std::vector<Halfedge> halfedges_;
156 std::vector<Edge> edges_;
A connected component of a SurfaceMesh.
Definition surface_mesh_components.h:27
const std::vector< Edge > & edges() const
Returns the list of edges in this component.
Definition surface_mesh_components.h:82
SurfaceMesh::Vertex Vertex
Vertex type.
Definition surface_mesh_components.h:31
const std::vector< Vertex > & vertices() const
Returns the list of vertices in this component.
Definition surface_mesh_components.h:76
SurfaceMesh * to_mesh() const
Constructs a surface mesh from this component.
Definition surface_mesh_components.cpp:53
SurfaceMesh::Face Face
Face type.
Definition surface_mesh_components.h:30
void translate(const vec3 &offset)
Translates this component by an offset vector.
Definition surface_mesh_components.cpp:180
static std::vector< SurfaceMeshComponent > extract(SurfaceMesh *mesh, bool descending=true)
Extracts connected components from the given mesh.
Definition surface_mesh_components.cpp:187
float area() const
Returns the surface area of this component.
Definition surface_mesh_components.cpp:119
std::size_t n_faces() const
Returns the number of faces in this component.
Definition surface_mesh_components.h:94
const std::vector< Halfedge > & halfedges() const
Returns the list of halfedges in this component.
Definition surface_mesh_components.h:88
SurfaceMesh::Halfedge Halfedge
Halfedge type.
Definition surface_mesh_components.h:33
std::size_t n_vertices() const
Returns the number of vertices in this component.
Definition surface_mesh_components.h:100
Box3 bbox() const
Returns the bounding box of this component.
Definition surface_mesh_components.cpp:171
SurfaceMesh::Edge Edge
Edge type.
Definition surface_mesh_components.h:32
const std::vector< Face > & faces() const
Returns the list of faces in this component.
Definition surface_mesh_components.h:70
std::size_t n_edges() const
Returns the number of edges in this component.
Definition surface_mesh_components.h:106
SurfaceMesh * mesh() const
Returns the surface mesh to which this component belongs.
Definition surface_mesh_components.h:118
SurfaceMeshComponent(SurfaceMesh *mesh)
Constructor that initializes the component with a given mesh.
Definition surface_mesh_components.h:40
float border_length() const
Returns the total border length of this component.
Definition surface_mesh_components.cpp:155
std::size_t n_halfedges() const
Returns the number of halfedges in this component.
Definition surface_mesh_components.h:112
A halfedge data structure for polygonal meshes of 2-manifold.
Definition surface_mesh.h:51
Definition collider.cpp:182
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition types.h:44
GenericBox< 3, float > Box3
A 3D axis-aligned bounding box of float type.
Definition types.h:108
Definition surface_mesh.h:173
Definition surface_mesh.h:191
This type represents a halfedge (internally it is basically an index).
Definition surface_mesh.h:155
This type represents a vertex (internally it is basically an index).
Definition surface_mesh.h:135