|
PolyFEM
|
Minimal polygonal surface mesh used as the storage of CMesh2D. More...
#include <PolygonMesh.hpp>
Classes | |
| struct | Point |
| 3D point. More... | |
Public Member Functions | |
| void | clear () |
| Removes all vertices, facets and edges. | |
| int | n_vertices () const |
| const Point & | point (const int v) const |
| Point & | point (const int v) |
| int | create_vertices (int n) |
| Appends n vertices at the origin and returns the index of the first one. | |
| int | create_vertex (const Point &p) |
| Appends a vertex and returns its index. | |
| void | bounding_box (Point &min, Point &max) const |
| Bounding box of the vertices (min/max are initialized to the largest and lowest doubles, as geogram's get_bbox does). | |
| int | n_facets () const |
| int | n_facet_vertices (const int f) const |
| int | facet_vertex (const int f, const int lv) const |
| int | n_corners () const |
| int | corners_begin (const int f) const |
| int | corners_end (const int f) const |
| int | facet_corner (const int f, const int lv) const |
| int | corner_vertex (const int c) const |
| int | corner_adjacent_facet (const int c) const |
| Facet across the edge from corner c to the next corner of its facet, or -1. | |
| int | next_corner_around_facet (const int f, const int c) const |
| int | prev_corner_around_facet (const int f, const int c) const |
| int | create_polygon (const std::vector< int > &vertices) |
| Appends a polygon (not glued to its neighbors) and returns its index. | |
| void | flip_facet (int f) |
| Reverses the orientation of facet f (its vertex list is reversed). | |
| void | clear_facets () |
| Removes all facets, keeping the vertices and the edges. | |
| void | delete_facets (const std::vector< bool > &to_delete) |
| Removes the facets f with to_delete[f], keeping all vertices, and renumbers the remaining facets (and the corner adjacency) in order. | |
| void | connect_facets () |
| Glues every corner without neighbor to the facet sharing its edge in opposite orientation (already glued corners are kept). | |
| int | connected_components (std::vector< int > &component) const |
| Assigns to each facet the index of its connected component (through the corner adjacency) and returns the number of components. | |
| int | n_edges () const |
| int | edge_vertex (const int e, const int lv) const |
| int | create_edge (int v0, int v1) |
| void | clear_edges () |
Public Attributes | |
| std::vector< int > | corner_edge |
| Index of the edge starting at each corner. | |
| std::vector< bool > | boundary_edge |
| Whether each edge is on the boundary. | |
| std::vector< bool > | boundary_vertex |
| Whether each vertex is on the boundary. | |
Private Attributes | |
| std::vector< Point > | points_ |
| std::vector< int > | facet_ptr_ = {0} |
| std::vector< int > | corner_vertex_ |
| std::vector< int > | corner_adjacent_facet_ |
| std::vector< std::array< int, 2 > > | edges_ |
Minimal polygonal surface mesh used as the storage of CMesh2D.
Vertices carry 3D positions (z = 0 for planar meshes), facets are polygons stored as contiguous ranges of corners, and each corner knows the facet across the edge that starts at it. Edges and boundary flags are derived data filled by Navigation::prepare_mesh().
The connectivity semantics (facet gluing, facet flipping and deletion) and the point arithmetic follow geogram's GEO::Mesh, which this class replaces, so that meshes built with it are identical to the ones PolyFEM used to build.
Definition at line 19 of file PolygonMesh.hpp.
Bounding box of the vertices (min/max are initialized to the largest and lowest doubles, as geogram's get_bbox does).
Definition at line 37 of file PolygonMesh.cpp.
References points_.
Referenced by polyfem::mesh::CMesh2D::bounding_box(), and polyfem::mesh::CMesh2D::normalize().
| void polyfem::mesh::PolygonMesh::clear | ( | ) |
Removes all vertices, facets and edges.
Definition at line 10 of file PolygonMesh.cpp.
References boundary_edge, boundary_vertex, corner_adjacent_facet_, corner_edge, corner_vertex_, edges_, facet_ptr_, and points_.
Referenced by polyfem::mesh::CMesh2D::build_topology(), and polyfem::mesh::CMesh2D::refine().
| void polyfem::mesh::PolygonMesh::clear_edges | ( | ) |
Definition at line 205 of file PolygonMesh.cpp.
References boundary_edge, and edges_.
Referenced by polyfem::mesh::refine_polygonal_mesh(), and polyfem::mesh::refine_triangle_mesh().
| void polyfem::mesh::PolygonMesh::clear_facets | ( | ) |
Removes all facets, keeping the vertices and the edges.
Definition at line 85 of file PolygonMesh.cpp.
References corner_adjacent_facet_, corner_edge, corner_vertex_, and facet_ptr_.
Referenced by polyfem::mesh::refine_polygonal_mesh(), and polyfem::mesh::refine_triangle_mesh().
| void polyfem::mesh::PolygonMesh::connect_facets | ( | ) |
Glues every corner without neighbor to the facet sharing its edge in opposite orientation (already glued corners are kept).
Definition at line 126 of file PolygonMesh.cpp.
References corner_adjacent_facet_, corner_vertex_, corners_begin(), corners_end(), n_corners(), n_facets(), n_vertices(), next_corner_around_facet(), and prev_corner_around_facet().
| int polyfem::mesh::PolygonMesh::connected_components | ( | std::vector< int > & | component | ) | const |
Assigns to each facet the index of its connected component (through the corner adjacency) and returns the number of components.
Definition at line 168 of file PolygonMesh.cpp.
References corner_adjacent_facet_, corners_begin(), corners_end(), and n_facets().
|
inline |
Facet across the edge from corner c to the next corner of its facet, or -1.
Definition at line 77 of file PolygonMesh.hpp.
|
inline |
Definition at line 75 of file PolygonMesh.hpp.
|
inline |
Definition at line 72 of file PolygonMesh.hpp.
Referenced by connect_facets(), connected_components(), delete_facets(), and flip_facet().
|
inline |
Definition at line 73 of file PolygonMesh.hpp.
Referenced by connect_facets(), connected_components(), and delete_facets().
| int polyfem::mesh::PolygonMesh::create_edge | ( | int | v0, |
| int | v1 | ||
| ) |
Definition at line 198 of file PolygonMesh.cpp.
References boundary_edge, and edges_.
| int polyfem::mesh::PolygonMesh::create_polygon | ( | const std::vector< int > & | vertices | ) |
Appends a polygon (not glued to its neighbors) and returns its index.
Definition at line 54 of file PolygonMesh.cpp.
References corner_adjacent_facet_, corner_edge, corner_vertex_, facet_ptr_, n_facets(), and n_vertices().
Referenced by polyfem::mesh::CMesh2D::append(), polyfem::mesh::CMesh2D::build_topology(), polyfem::mesh::refine_polygonal_mesh(), and polyfem::mesh::refine_triangle_mesh().
| int polyfem::mesh::PolygonMesh::create_vertex | ( | const Point & | p | ) |
Appends a vertex and returns its index.
Definition at line 30 of file PolygonMesh.cpp.
References create_vertices(), and points_.
| int polyfem::mesh::PolygonMesh::create_vertices | ( | int | n | ) |
Appends n vertices at the origin and returns the index of the first one.
Definition at line 22 of file PolygonMesh.cpp.
References boundary_vertex, n_vertices(), and points_.
Referenced by polyfem::mesh::CMesh2D::append(), polyfem::mesh::CMesh2D::build_topology(), and create_vertex().
| void polyfem::mesh::PolygonMesh::delete_facets | ( | const std::vector< bool > & | to_delete | ) |
Removes the facets f with to_delete[f], keeping all vertices, and renumbers the remaining facets (and the corner adjacency) in order.
Definition at line 93 of file PolygonMesh.cpp.
References corner_adjacent_facet_, corner_edge, corner_vertex_, corners_begin(), corners_end(), facet_ptr_, and n_facets().
Referenced by polyfem::mesh::CMesh2D::remove_elements().
|
inline |
Definition at line 105 of file PolygonMesh.hpp.
Referenced by polyfem::mesh::CMesh2D::edge_barycenter(), polyfem::mesh::CMesh2D::edge_length(), polyfem::mesh::CMesh2D::edge_vertex(), and polyfem::mesh::CMesh2D::refine().
|
inline |
Definition at line 74 of file PolygonMesh.hpp.
|
inline |
Definition at line 69 of file PolygonMesh.hpp.
Referenced by polyfem::mesh::CMesh2D::append(), polyfem::mesh::CMesh2D::attach_higher_order_nodes(), polyfem::mesh::CMesh2D::cell_vertex(), polyfem::mesh::CMesh2D::face_vertex(), polyfem::mesh::refine_polygonal_mesh(), and polyfem::mesh::refine_triangle_mesh().
| void polyfem::mesh::PolygonMesh::flip_facet | ( | int | f | ) |
Reverses the orientation of facet f (its vertex list is reversed).
Definition at line 68 of file PolygonMesh.cpp.
References corner_adjacent_facet_, corner_vertex_, corners_begin(), and n_facet_vertices().
|
inline |
Definition at line 71 of file PolygonMesh.hpp.
Referenced by connect_facets().
|
inline |
Definition at line 104 of file PolygonMesh.hpp.
Referenced by polyfem::mesh::CMesh2D::n_edges(), polyfem::mesh::CMesh2D::refine(), polyfem::mesh::refine_polygonal_mesh(), and polyfem::mesh::refine_triangle_mesh().
|
inline |
Definition at line 68 of file PolygonMesh.hpp.
Referenced by polyfem::mesh::CMesh2D::append(), flip_facet(), polyfem::mesh::CMesh2D::n_face_vertices(), polyfem::mesh::refine_polygonal_mesh(), and polyfem::mesh::refine_triangle_mesh().
|
inline |
Definition at line 67 of file PolygonMesh.hpp.
Referenced by connect_facets(), connected_components(), create_polygon(), delete_facets(), polyfem::mesh::CMesh2D::n_faces(), polyfem::mesh::refine_polygonal_mesh(), polyfem::mesh::refine_triangle_mesh(), and polyfem::mesh::CMesh2D::remove_elements().
|
inline |
Definition at line 52 of file PolygonMesh.hpp.
Referenced by polyfem::mesh::CMesh2D::append(), connect_facets(), create_polygon(), create_vertices(), polyfem::mesh::CMesh2D::n_vertices(), polyfem::mesh::CMesh2D::normalize(), polyfem::mesh::CMesh2D::refine(), polyfem::mesh::refine_polygonal_mesh(), and polyfem::mesh::refine_triangle_mesh().
|
inline |
Definition at line 78 of file PolygonMesh.hpp.
Referenced by connect_facets().
|
inline |
Definition at line 54 of file PolygonMesh.hpp.
|
inline |
Definition at line 53 of file PolygonMesh.hpp.
Referenced by polyfem::mesh::CMesh2D::build_topology(), polyfem::mesh::CMesh2D::normalize(), polyfem::mesh::CMesh2D::point(), and polyfem::mesh::CMesh2D::set_point().
|
inline |
Definition at line 79 of file PolygonMesh.hpp.
Referenced by connect_facets().
| std::vector<bool> polyfem::mesh::PolygonMesh::boundary_edge |
Whether each edge is on the boundary.
Definition at line 112 of file PolygonMesh.hpp.
Referenced by clear(), clear_edges(), create_edge(), and polyfem::mesh::CMesh2D::is_boundary_edge().
| std::vector<bool> polyfem::mesh::PolygonMesh::boundary_vertex |
Whether each vertex is on the boundary.
Definition at line 114 of file PolygonMesh.hpp.
Referenced by clear(), create_vertices(), and polyfem::mesh::CMesh2D::is_boundary_vertex().
|
private |
Definition at line 120 of file PolygonMesh.hpp.
Referenced by clear(), clear_facets(), connect_facets(), connected_components(), create_polygon(), delete_facets(), and flip_facet().
| std::vector<int> polyfem::mesh::PolygonMesh::corner_edge |
Index of the edge starting at each corner.
Definition at line 110 of file PolygonMesh.hpp.
Referenced by clear(), clear_facets(), create_polygon(), and delete_facets().
|
private |
Definition at line 119 of file PolygonMesh.hpp.
Referenced by clear(), clear_facets(), connect_facets(), create_polygon(), delete_facets(), and flip_facet().
|
private |
Definition at line 121 of file PolygonMesh.hpp.
Referenced by clear(), clear_edges(), and create_edge().
|
private |
Definition at line 118 of file PolygonMesh.hpp.
Referenced by clear(), clear_facets(), create_polygon(), and delete_facets().
|
private |
Definition at line 117 of file PolygonMesh.hpp.
Referenced by bounding_box(), clear(), create_vertex(), and create_vertices().