|
PolyFEM
|
Namespaces | |
| namespace | MeshProcessing3D |
| namespace | Navigation |
| namespace | Navigation3D |
| namespace | Polygons |
Classes | |
| class | ArrayRow |
| Contiguous view of one row of a JaggedArray (like std::span). More... | |
| struct | CellDescriptor |
| Local facets of a standard cell: for each facet, its local vertices, ordered so that the facet normal points outside the cell. More... | |
| class | CMesh2D |
| Conforming 2D mesh of arbitrary polygons, stored in a PolygonMesh. More... | |
| class | CMesh3D |
| Conforming 3D mesh of tetrahedra, hexahedra, prisms, pyramids and general polyhedra, stored in a Mesh3DStorage. More... | |
| class | GeometryLoader |
| Applies geometry JSON semantics while delegating all decoding to MeshLoader. More... | |
| class | JaggedArray |
| Rows of different lengths stored contiguously (compressed rows): row i is data[offsets[i], offsets[i + 1]). More... | |
| class | LoadedGeometry |
| class | LocalBoundary |
| Boundary primitive IDs for a single element. More... | |
| class | Mesh |
| Abstract mesh class to capture 2d/3d conforming and non-conforming meshes. More... | |
| class | Mesh2D |
| 2D mesh interface: the elements are the faces (polygons) and the boundary elements are the edges. More... | |
| class | Mesh3D |
| 3D mesh interface: the elements are the cells (tetrahedra, hexahedra, prisms, pyramids or general polyhedra) and the boundary elements are the faces. More... | |
| class | Mesh3DStorage |
| Topology of a conforming 3D mesh (used by CMesh3D), stored as flat arrays indexed by entity id. More... | |
| struct | Mesh_Quality |
| class | MeshData |
| Format-independent input used to construct a runtime Mesh. More... | |
| class | MeshLoader |
| The only non-legacy decoder from a logical resource path to mesh data. More... | |
| class | MeshNodes |
| class | MeshReader |
| Stateless format decoders used exclusively by MeshLoader and in-memory adapters. More... | |
| struct | MeshWithID |
| class | NCMesh2D |
| Non-conforming 2D triangle mesh with hanging nodes, for adaptive h-refinement: refine_element() splits a triangle into 4, and the edges of a refined neighbor become "followers" of the coarse "leader" edge. More... | |
| class | NCMesh3D |
| Non-conforming 3D tetrahedral mesh with hanging nodes, for adaptive h-refinement: refine_element() splits a tetrahedron into 8, and the edges/faces of a refined neighbor become "followers" of the coarse "leader" edge/face. More... | |
| class | Obstacle |
| class | PolygonMesh |
| Minimal polygonal surface mesh used as the storage of CMesh2D. More... | |
| class | SortedIds |
| Set of ids stored as a sorted vector: iterates in increasing order like std::set<int>, but uses a fraction of its memory for the short element lists of the non-conforming meshes. More... | |
| struct | StandardCell |
| A standard cell referencing global vertex indices. More... | |
| class | SurfaceMeshData |
Typedefs | |
| typedef std::function< void(const Eigen::MatrixXd &, Eigen::MatrixXd &, int)> | EvalParametersFunc |
| typedef std::function< std::tuple< int, int, bool >(int, int)> | GetAdjacentLocalEdge |
| using | SurfaceMesh = SurfaceMeshData |
| template<typename T , int MaxSize> | |
| using | InlineVector = Eigen::Matrix< T, Eigen::Dynamic, 1, Eigen::ColMajor, MaxSize, 1 > |
| Small vector stored inline (no heap allocation), with the VectorXi / VectorXd API; used for the per-entity data of the non-conforming meshes. | |
Enumerations | |
| enum class | CollisionProxyTessellation { REGULAR , IRREGULAR } |
| enum class | BoundaryType { TRI_LINE , QUAD_LINE , PRISM , PYRAMID , TRI , QUAD , POLYGON , POLYHEDRON , INVALID } |
| enum class | ElementType { SIMPLEX = 0 , REGULAR_INTERIOR_CUBE , SIMPLE_SINGULAR_INTERIOR_CUBE , MULTI_SINGULAR_INTERIOR_CUBE , REGULAR_BOUNDARY_CUBE , SIMPLE_SINGULAR_BOUNDARY_CUBE , MULTI_SINGULAR_BOUNDARY_CUBE , INTERFACE_CUBE , INTERIOR_POLYTOPE , BOUNDARY_POLYTOPE , PRISM , PYRAMID , UNDEFINED } |
| Type of Element, check [Poly-Spline Finite Element Method] for a complete description. More... | |
| enum class | StandardCellType { TET , HEX , PRISM , PYRAMID } |
| Standard volume cell types with a fixed local facet layout. More... | |
| enum class | MeshType { TRI = 0 , QUA , H_SUR , TET , HYB , HEX } |
Functions | |
| void | build_collision_proxy (const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &geom_bases, const std::vector< LocalBoundary > &total_local_boundary, const int n_bases, const int dim, const double max_edge_length, Eigen::MatrixXd &proxy_vertices, Eigen::MatrixXi &proxy_faces, std::vector< Eigen::Triplet< double > > &displacement_map_entries, const CollisionProxyTessellation tessellation) |
| void | build_collision_proxy_displacement_map (const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &geom_bases, const std::vector< mesh::LocalBoundary > &total_local_boundary, const int n_bases, const int dim, const Eigen::MatrixXd &proxy_vertices, std::vector< Eigen::Triplet< double > > &displacement_map) |
| Build a collision proxy displacement map for a given mesh and proxy mesh. | |
| void | load_collision_proxy (const io::ResourceIO &resources, const std::string &mesh_filename, const std::string &weights_filename, const Eigen::VectorXi &in_node_to_node, const json &transformation, Eigen::MatrixXd &vertices, Eigen::VectorXi &codim_vertices, Eigen::MatrixXi &edges, Eigen::MatrixXi &faces, std::vector< Eigen::Triplet< double > > &displacement_map_entries) |
| Load a collision proxy mesh and displacement map from resources. | |
| void | load_collision_proxy_mesh (const io::ResourceIO &resources, const std::string &mesh_filename, const json &transformation, Eigen::MatrixXd &vertices, Eigen::VectorXi &codim_vertices, Eigen::MatrixXi &edges, Eigen::MatrixXi &faces) |
| Load a collision proxy mesh from a resource. | |
| void | load_collision_proxy_displacement_map (const io::ResourceIO &resources, const std::string &weights_filename, const Eigen::VectorXi &in_node_to_node, const size_t num_proxy_vertices, std::vector< Eigen::Triplet< double > > &displacement_map_entries) |
| Load a collision proxy displacement map from a resource. | |
| NLOHMANN_JSON_SERIALIZE_ENUM (CollisionProxyTessellation, {{CollisionProxyTessellation::REGULAR, "regular"}, {CollisionProxyTessellation::IRREGULAR, "irregular"}}) | |
| void | build_collision_proxy (const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &geom_bases, const std::vector< mesh::LocalBoundary > &total_local_boundary, const int n_bases, const int dim, const double max_edge_length, Eigen::MatrixXd &proxy_vertices, Eigen::MatrixXi &proxy_faces, std::vector< Eigen::Triplet< double > > &displacement_map, const CollisionProxyTessellation tessellation=CollisionProxyTessellation::REGULAR) |
| Build a collision proxy mesh by upsampling a given mesh. | |
| void | stitch_mesh (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, Eigen::MatrixXd &V_out, Eigen::MatrixXi &F_out, const double epsilon=1e-5) |
| Stitch a triangle mesh (V, F) together by removing duplicate vertices. | |
| void | stitch_mesh (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const std::vector< Eigen::Triplet< double > > &W, Eigen::MatrixXd &V_out, Eigen::MatrixXi &F_out, std::vector< Eigen::Triplet< double > > &W_out, const double epsilon=1e-5) |
| Stitch a triangle mesh (V, F) together by removing duplicate vertices. | |
| double | max_edge_length (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) |
| Compute the maximum edge length of a triangle mesh (V, F) | |
| void | regular_grid_triangle_barycentric_coordinates (const int n, Eigen::MatrixXd &V, Eigen::MatrixXi &F) |
| Compute the barycentric coordinates of a regular grid of triangles. | |
| void | regular_grid_tessellation (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const double max_edge_length, Eigen::MatrixXd &V_out, Eigen::MatrixXi &F_out) |
| Tessilate a triangle mesh (V, F) with regular grids of triangles of maximum edge length. | |
| Eigen::MatrixXd | refine_edge (const VectorNd &a, const VectorNd &b, const double max_edge_length) |
| Refine an edge (a, b) so each refined edge has length at most max_edge_length. | |
| void | refine_triangle_edges (const VectorNd &a, const VectorNd &b, const VectorNd &c, const double max_edge_len, Eigen::MatrixXd &V, Eigen::MatrixXi &E) |
| Refine the edges of a triangle (a, b, c) so each refined edge has length at most max_edge_length. | |
| void | irregular_triangle (const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c, const double max_edge_length, Eigen::MatrixXd &V, Eigen::MatrixXi &F) |
| Refine a triangle (a, b, c) into a well shaped triangle mesh. | |
| void | irregular_triangle_barycentric_coordinates (const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c, const double max_edge_length, Eigen::MatrixXd &UV, Eigen::MatrixXi &F) |
| Refine a triangle (a, b, c) into a well shaped triangle mesh. | |
| void | irregular_tessellation (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const double max_edge_length, Eigen::MatrixXd &V_out, Eigen::MatrixXi &F_out) |
| Tessilate a triangle mesh (V, F) with well shaped triangles. | |
| std::ostream & | operator<< (std::ostream &os, const LocalBoundary &lb) |
| int | find (const Eigen::VectorXi &vec, int x) |
| double | line_weight (const Eigen::Matrix< double, 2, 2 > &e, const InlineVector< double, 3 > &v) |
| void | clip_polygon_by_half_plane (const Eigen::MatrixXd &P, const Eigen::RowVector2d &q1, const Eigen::RowVector2d &q2, Eigen::MatrixXd &result) |
| Clip a polygon by a half-plane. | |
| void | compute_visibility_kernel (const Eigen::MatrixXd &IV, Eigen::MatrixXd &OV) |
| Determine the kernel of the given polygon. | |
| bool | is_star_shaped (const Eigen::MatrixXd &IV, Eigen::RowVector3d &bary) |
| Determine whether a polygon is star-shaped or not. | |
| void | offset_polygon (const Eigen::MatrixXd &IV, Eigen::MatrixXd &OV, double eps) |
| Compute offset polygon. | |
| int | is_inside (const Eigen::MatrixXd &IV, const Eigen::MatrixXd &Q, std::vector< bool > &inside) |
| Compute whether points are inside a polygon. | |
| void | sample_polygon (const Eigen::MatrixXd &IV, int num_samples, Eigen::MatrixXd &S) |
| Sample equal-arclength interval midpoints, starting at the lexicographically smallest polygon vertex. | |
| void | edge_adjacency_graph (const Eigen::MatrixXi &Q, Eigen::MatrixXi &edge_index, std::vector< std::vector< int > > &adj, std::vector< std::pair< int, int > > *pairs_of_edges=nullptr, std::vector< std::pair< int, int > > *pairs_of_quads=nullptr, Eigen::MatrixXi *quad_index=nullptr) |
| bool | instantiate_pattern (const Eigen::MatrixXd &IV, const Eigen::MatrixXi &IF, const Eigen::MatrixXd &PV, const Eigen::MatrixXi &PF, Eigen::MatrixXd &OV, Eigen::MatrixXi &OF, Eigen::VectorXi *SF=nullptr, EvalParametersFunc evalFunc=nullptr, GetAdjacentLocalEdge getAdjLocalEdge=nullptr) |
| void | refine_quad_mesh (const Eigen::MatrixXd &IV, const Eigen::MatrixXi &IF, Eigen::MatrixXd &OV, Eigen::MatrixXi &OF) |
| void | refine_polygonal_mesh (const PolygonMesh &M_in, PolygonMesh &M_out, Polygons::SplitFunction split_func) |
| Refine a polygonal mesh. | |
| void | refine_triangle_mesh (const PolygonMesh &M_in, PolygonMesh &M_out) |
| Refine a triangle mesh. | |
| void | refine_polygonal_mesh (const PolygonMesh &M_in, PolygonMesh &M_out, bool refine_polygons=false, double t=0.5) |
| const CellDescriptor & | cell_descriptor (StandardCellType type) |
| Local vertex and facet conventions of each cell type. | |
| std::vector< std::array< int, 6 > > | connect_cells (const std::vector< StandardCell > &cells, int n_vertices) |
| Computes cell-to-cell adjacency across facets. | |
| PolygonMesh::Point | mesh_vertex (const PolygonMesh &M, int v) |
| Retrieve a 3D vector with the position of a given vertex. | |
| PolygonMesh::Point | facet_barycenter (const PolygonMesh &M, int f) |
| int | mesh_create_vertex (PolygonMesh &M, const PolygonMesh::Point &p) |
| void | compute_element_tags (const PolygonMesh &M, std::vector< ElementType > &element_tags) |
| Compute the type of each facet in a surface mesh. | |
| void | orient_normals_2d (PolygonMesh &M) |
| Orient facets of a 2D mesh so that each connected component has positive volume. | |
| void | reorder_mesh (Eigen::MatrixXd &V, Eigen::MatrixXi &F, const Eigen::VectorXi &C, Eigen::VectorXi &R) |
| Reorder vertices of a mesh using color tags, so that vertices are ordered by increasing colors. | |
| void | offset_surface_vertices (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const Eigen::RowVector3d &interior_point, double distance, Eigen::MatrixXd &offset) |
| Offset along area-weighted surface normals, using the direction away from an interior point where incident normals cancel. | |
| void | signed_squared_distances (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const Eigen::MatrixXd &P, Eigen::VectorXd &D) |
| Computes the signed squared distance from a list of points to a triangle mesh. | |
| double | signed_volume (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) |
| Compute the signed volume of a surface mesh. | |
| void | orient_closed_surface (const Eigen::MatrixXd &V, Eigen::MatrixXi &F, bool positive=true) |
| Orient a triangulated surface to have positive volume. | |
| std::vector< std::pair< Navigation::Index, Navigation::Index > > | compute_mesh_interface (const Mesh2D &first, const Mesh2D &second) |
| Pair coincident boundary edges, including nonconforming leader/follower edges. | |
| std::vector< std::pair< Navigation3D::Index, Navigation3D::Index > > | compute_mesh_interface (const Mesh3D &first, const Mesh3D &second) |
| Pair coincident boundary faces, including nonconforming leader/follower faces. | |
| void | extract_parent_edges (const Eigen::MatrixXd &IV, const Eigen::MatrixXi &IE, const Eigen::MatrixXd &BV, const Eigen::MatrixXi &BE, Eigen::MatrixXi &OE) |
| Extract a set of edges that are overlap with a set given set of parent edges, using vertices positions to discriminate. | |
| void | find_triangle_surface_from_tets (const Eigen::MatrixXi &tets, Eigen::MatrixXi &faces) |
| Boundary triangles of a tet mesh, indexing the tets' vertices. | |
| void | extract_triangle_surface_from_tets (const Eigen::MatrixXd &vertices, const Eigen::MatrixXi &tets, Eigen::MatrixXd &surface_vertices, Eigen::MatrixXi &tris) |
| Extract triangular surface from a tetmesh. | |
| bool | is_planar (const Eigen::MatrixXd &V, const double tol=1e-5) |
| Determine if the given V x (2|3) vertices are planar (2D or z-range below tol). | |
| int | count_faces (const int dim, const Eigen::MatrixXi &cells) |
| Count the number of boundary elements (triangles for tetmesh and edges for triangle mesh) | |
| void | generate_edges (PolygonMesh &M) |
| Creates the edges of M (sorted by vertex pair) if it has none yet. | |
| double | point_triangle_squared_distance (const double *p, const double *v0, const double *v1, const double *v2) |
| Squared distance between a point and a triangle. | |
| bool | apply_slim (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const Eigen::MatrixXd &V_new, Eigen::MatrixXd &V_smooth, const int max_iters) |
Variables | |
| constexpr long | MESH_SCHEMA_VERSION = 1 |
| The canonical typed mesh schema shared by HDF5 bundles and checkpoints. | |
| typedef std::function<void(const Eigen::MatrixXd &, Eigen::MatrixXd &, int)> polyfem::mesh::EvalParametersFunc |
Definition at line 30 of file Refinement.hpp.
| typedef std::function<std::tuple<int, int, bool>(int, int)> polyfem::mesh::GetAdjacentLocalEdge |
Definition at line 31 of file Refinement.hpp.
| using polyfem::mesh::InlineVector = typedef Eigen::Matrix<T, Eigen::Dynamic, 1, Eigen::ColMajor, MaxSize, 1> |
Small vector stored inline (no heap allocation), with the VectorXi / VectorXd API; used for the per-entity data of the non-conforming meshes.
Definition at line 13 of file NCMeshStorage.hpp.
| using polyfem::mesh::SurfaceMesh = typedef SurfaceMeshData |
Definition at line 12 of file MeshLoader.hpp.
|
strong |
| Enumerator | |
|---|---|
| TRI_LINE | Boundary of a triangle in 2D. |
| QUAD_LINE | Boundary of a quad in 2D. |
| PRISM | |
| PYRAMID | |
| TRI | |
| QUAD | |
| POLYGON | |
| POLYHEDRON | |
| INVALID | |
Definition at line 12 of file LocalBoundary.hpp.
|
strong |
| Enumerator | |
|---|---|
| REGULAR | Regular tessellation of the mesh. |
| IRREGULAR | Irregular tessellation of the mesh (requires POLYFEM_WITH_TRIANGLE) |
Definition at line 17 of file CollisionProxy.hpp.
|
strong |
Type of Element, check [Poly-Spline Finite Element Method] for a complete description.
NOTE: For the purpose of the tagging, elements (facets in 2D, cells in 3D) adjacent to a polytope are tagged as boundary, and vertices incident to a polytope are also considered as boundary.
|
strong |
| Enumerator | |
|---|---|
| TRI | |
| QUA | |
| H_SUR | |
| TET | |
| HYB | |
| HEX | |
Definition at line 137 of file Mesh3DStorage.hpp.
|
strong |
Standard volume cell types with a fixed local facet layout.
| Enumerator | |
|---|---|
| TET | |
| HEX | |
| PRISM | |
| PYRAMID | |
Definition at line 9 of file CellConnectivity.hpp.
| bool polyfem::mesh::apply_slim | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F, | ||
| const Eigen::MatrixXd & | V_new, | ||
| Eigen::MatrixXd & | V_smooth, | ||
| const int | max_iters | ||
| ) |
Definition at line 11 of file SlimSmooth.cpp.
References polyfem::adjoint_logger(), polyfem::F, polyfem::utils::is_flipped(), polyfem::logger(), and V.
Referenced by polyfem::solver::AdjointNLProblem::after_line_search_custom_operation(), and polyfem::solver::AdjointNLProblem::is_step_valid().
| void polyfem::mesh::build_collision_proxy | ( | const std::vector< basis::ElementBases > & | bases, |
| const std::vector< basis::ElementBases > & | geom_bases, | ||
| const std::vector< LocalBoundary > & | total_local_boundary, | ||
| const int | n_bases, | ||
| const int | dim, | ||
| const double | max_edge_length, | ||
| Eigen::MatrixXd & | proxy_vertices, | ||
| Eigen::MatrixXi & | proxy_faces, | ||
| std::vector< Eigen::Triplet< double > > & | displacement_map_entries, | ||
| const CollisionProxyTessellation | tessellation | ||
| ) |
Definition at line 75 of file CollisionProxy.cpp.
References polyfem::basis::ElementBases::bases, IRREGULAR, irregular_triangle_barycentric_coordinates(), polyfem::log_and_throw_error(), max_edge_length(), REGULAR, regular_grid_triangle_barycentric_coordinates(), stitch_mesh(), TRI, and x.
Referenced by polyfem::varform::NonlinearElasticVarForm::build_collision_mesh().
| void polyfem::mesh::build_collision_proxy | ( | const std::vector< basis::ElementBases > & | bases, |
| const std::vector< basis::ElementBases > & | geom_bases, | ||
| const std::vector< mesh::LocalBoundary > & | total_local_boundary, | ||
| const int | n_bases, | ||
| const int | dim, | ||
| const double | max_edge_length, | ||
| Eigen::MatrixXd & | proxy_vertices, | ||
| Eigen::MatrixXi & | proxy_faces, | ||
| std::vector< Eigen::Triplet< double > > & | displacement_map, | ||
| const CollisionProxyTessellation | tessellation = CollisionProxyTessellation::REGULAR |
||
| ) |
Build a collision proxy mesh by upsampling a given mesh.
| [in] | bases | Bases for elements |
| [in] | geom_bases | Geometry bases for elements |
| [in] | total_local_boundary | Local boundaries for elements |
| [in] | n_bases | Number of bases (nodes) |
| [in] | dim | Dimension of the mesh |
| [in] | max_edge_length | Maximum edge length of the proxy mesh |
| [out] | proxy_vertices | Output vertices of the proxy mesh |
| [out] | proxy_faces | Output faces of the proxy mesh |
| [out] | displacement_map | Output displacement map from proxy mesh to original mesh |
| [in] | tessellation | Type of tessellation to use |
| void polyfem::mesh::build_collision_proxy_displacement_map | ( | const std::vector< basis::ElementBases > & | bases, |
| const std::vector< basis::ElementBases > & | geom_bases, | ||
| const std::vector< mesh::LocalBoundary > & | total_local_boundary, | ||
| const int | n_bases, | ||
| const int | dim, | ||
| const Eigen::MatrixXd & | proxy_vertices, | ||
| std::vector< Eigen::Triplet< double > > & | displacement_map | ||
| ) |
Build a collision proxy displacement map for a given mesh and proxy mesh.
| [in] | bases | Bases for elements |
| [in] | geom_bases | Geometry bases for elements |
| [in] | total_local_boundary | Local boundaries for elements |
| [in] | n_bases | Number of bases (nodes) |
| [in] | dim | Dimension of the mesh |
| [in] | proxy_vertices | Vertices of the proxy mesh |
| [out] | displacement_map | Output displacement map from proxy mesh to original mesh |
Definition at line 170 of file CollisionProxy.cpp.
References polyfem::log_and_throw_error().
| const CellDescriptor & polyfem::mesh::cell_descriptor | ( | StandardCellType | type | ) |
Local vertex and facet conventions of each cell type.
These are the conventions of geogram's MeshCellDescriptors, which PolyFEM used to build its volume meshes (local vertex order of hexes, facet order and facet vertex order all follow them).
Definition at line 187 of file CellConnectivity.cpp.
| void polyfem::mesh::clip_polygon_by_half_plane | ( | const Eigen::MatrixXd & | P, |
| const Eigen::RowVector2d & | q1, | ||
| const Eigen::RowVector2d & | q2, | ||
| Eigen::MatrixXd & | result | ||
| ) |
Clip a polygon by a half-plane.
| [in] | P | Input polygon |
| [in] | q1 | First endpoint of the clipping line |
| [in] | q2 | Second endpoint of the clipping line |
| [out] | result | Clipped polygon |
Definition at line 61 of file PolygonUtils.cpp.
Referenced by compute_visibility_kernel().
| void polyfem::mesh::compute_element_tags | ( | const PolygonMesh & | M, |
| std::vector< ElementType > & | element_tags | ||
| ) |
Compute the type of each facet in a surface mesh.
| [in] | M | Input surface mesh (with boundary flags, see Navigation::prepare_mesh) |
| [out] | element_tags | Types of each facet element |
Definition at line 65 of file MeshUtils.cpp.
Referenced by polyfem::mesh::CMesh2D::compute_elements_tag(), and polyfem::mesh::CMesh2D::update_elements_tag().
| std::vector< std::pair< polyfem::mesh::Navigation::Index, polyfem::mesh::Navigation::Index > > polyfem::mesh::compute_mesh_interface | ( | const Mesh2D & | first, |
| const Mesh2D & | second | ||
| ) |
Pair coincident boundary edges, including nonconforming leader/follower edges.
Definition at line 949 of file MeshUtils.cpp.
References polyfem::mesh::Mesh2D::get_index_from_face(), polyfem::mesh::Mesh::is_boundary_edge(), polyfem::mesh::Mesh::n_face_vertices(), polyfem::mesh::Mesh::n_faces(), polyfem::mesh::Mesh2D::next_around_face(), polyfem::mesh::Mesh::point(), and polyfem::mesh::Mesh2D::switch_vertex().
Referenced by polyfem::varform::NavierStokesFSIVarForm::load_mesh().
| std::vector< std::pair< polyfem::mesh::Navigation3D::Index, polyfem::mesh::Navigation3D::Index > > polyfem::mesh::compute_mesh_interface | ( | const Mesh3D & | first, |
| const Mesh3D & | second | ||
| ) |
Pair coincident boundary faces, including nonconforming leader/follower faces.
Definition at line 995 of file MeshUtils.cpp.
References polyfem::mesh::Mesh3D::cell_face(), polyfem::mesh::Mesh::face_vertex(), faces, polyfem::mesh::Mesh3D::get_index_from_element(), polyfem::mesh::Mesh::is_boundary_face(), polyfem::mesh::Mesh3D::n_cell_faces(), polyfem::mesh::Mesh::n_cells(), polyfem::mesh::Mesh::n_face_vertices(), polyfem::mesh::Mesh3D::next_around_face(), and polyfem::mesh::Mesh::point().
| void polyfem::mesh::compute_visibility_kernel | ( | const Eigen::MatrixXd & | IV, |
| Eigen::MatrixXd & | OV | ||
| ) |
Determine the kernel of the given polygon.
| [in] | IV | #IV x (2|3) vertex positions around the input polygon |
| [out] | OV | #OV x (2|3) vertex positions around the output polygon |
Definition at line 130 of file PolygonUtils.cpp.
References clip_polygon_by_half_plane().
Referenced by is_star_shaped().
| std::vector< std::array< int, 6 > > polyfem::mesh::connect_cells | ( | const std::vector< StandardCell > & | cells, |
| int | n_vertices | ||
| ) |
Computes cell-to-cell adjacency across facets.
Two cell facets are glued when they have the same vertices in opposite orientation. The traversal order (and therefore the choice made for non-manifold facets) reproduces geogram's MeshCells::connect(): tet meshes chain tet corners around vertices, other meshes chain cells around vertices, and candidates are visited from the most recently created cell to the oldest one.
A quadrilateral boundary facet glued to two or more triangular facets (a non-conforming quad/triangle interface) is rejected: geogram used to insert artificial "connector" cells there, which PolyFEM cannot use.
| [in] | cells | Input cells |
| [in] | n_vertices | Number of vertices referenced by the cells |
Definition at line 204 of file CellConnectivity.cpp.
References polyfem::mesh::StandardCell::facet_vertex(), HEX, polyfem::log_and_throw_error(), and TET.
Referenced by polyfem::mesh::CMesh3D::build_storage_from_cells().
| int polyfem::mesh::count_faces | ( | const int | dim, |
| const Eigen::MatrixXi & | cells | ||
| ) |
Count the number of boundary elements (triangles for tetmesh and edges for triangle mesh)
Definition at line 1170 of file MeshUtils.cpp.
| void polyfem::mesh::edge_adjacency_graph | ( | const Eigen::MatrixXi & | Q, |
| Eigen::MatrixXi & | edge_index, | ||
| std::vector< std::vector< int > > & | adj, | ||
| std::vector< std::pair< int, int > > * | pairs_of_edges = nullptr, |
||
| std::vector< std::pair< int, int > > * | pairs_of_quads = nullptr, |
||
| Eigen::MatrixXi * | quad_index = nullptr |
||
| ) |
Definition at line 16 of file Refinement.cpp.
Referenced by instantiate_pattern().
| void polyfem::mesh::extract_parent_edges | ( | const Eigen::MatrixXd & | IV, |
| const Eigen::MatrixXi & | IE, | ||
| const Eigen::MatrixXd & | BV, | ||
| const Eigen::MatrixXi & | BE, | ||
| Eigen::MatrixXi & | OE | ||
| ) |
Extract a set of edges that are overlap with a set given set of parent edges, using vertices positions to discriminate.
| [in] | IV | #IV x 3 input vertices positions |
| [in] | IE | #IE x 2 input edge indices |
| [in] | BV | #BV x 3 base vertices positions to test against |
| [in] | BE | #BE x 2 base edge indices to test against |
| [out] | OE | #OE x 2 output extracted edges |
Definition at line 1057 of file MeshUtils.cpp.
Referenced by polyfem::utils::RefElementSampler::build().
| void polyfem::mesh::extract_triangle_surface_from_tets | ( | const Eigen::MatrixXd & | vertices, |
| const Eigen::MatrixXi & | tets, | ||
| Eigen::MatrixXd & | surface_vertices, | ||
| Eigen::MatrixXi & | tris | ||
| ) |
Extract triangular surface from a tetmesh.
| [in] | v,tets | tet mesh |
| [out] | s_v,tris | { surface mesh } |
Definition at line 1131 of file MeshUtils.cpp.
References find_triangle_surface_from_tets().
Referenced by polyfem::mesh::MeshReader::read_msh_surface().
| polyfem::mesh::PolygonMesh::Point polyfem::mesh::facet_barycenter | ( | const PolygonMesh & | M, |
| int | f | ||
| ) |
Definition at line 46 of file MeshUtils.cpp.
References mesh_vertex().
Referenced by refine_polygonal_mesh().
| int polyfem::mesh::find | ( | const Eigen::VectorXi & | vec, |
| int | x | ||
| ) |
Definition at line 369 of file NCMesh2D.cpp.
Referenced by polyfem::mesh::NCMesh2D::build_element_vertex_adjacency(), polyfem::mesh::Navigation3D::get_index_from_element_face(), polyfem::io::ResourceIO::glob(), polyfem::mesh::MeshProcessing3D::refine_catmul_clark_polar(), and polyfem::mesh::NCMesh2D::switch_edge().
| void polyfem::mesh::find_triangle_surface_from_tets | ( | const Eigen::MatrixXi & | tets, |
| Eigen::MatrixXi & | faces | ||
| ) |
Boundary triangles of a tet mesh, indexing the tets' vertices.
| [in] | tets | #T x 4 tet indices |
| [out] | faces | F x 3 boundary triangle indices |
Definition at line 1097 of file MeshUtils.cpp.
References faces.
Referenced by extract_triangle_surface_from_tets(), and polyfem::mesh::MeshReader::read_msh_surface().
| void polyfem::mesh::generate_edges | ( | PolygonMesh & | M | ) |
Creates the edges of M (sorted by vertex pair) if it has none yet.
| [in/out] | M mesh to append edges to |
Definition at line 1220 of file MeshUtils.cpp.
Referenced by polyfem::mesh::CMesh2D::refine().
| bool polyfem::mesh::instantiate_pattern | ( | const Eigen::MatrixXd & | IV, |
| const Eigen::MatrixXi & | IF, | ||
| const Eigen::MatrixXd & | PV, | ||
| const Eigen::MatrixXi & | PF, | ||
| Eigen::MatrixXd & | OV, | ||
| Eigen::MatrixXi & | OF, | ||
| Eigen::VectorXi * | SF = nullptr, |
||
| EvalParametersFunc | evalFunc = nullptr, |
||
| GetAdjacentLocalEdge | getAdjLocalEdge = nullptr |
||
| ) |
Definition at line 276 of file Refinement.cpp.
References adj, edge_adjacency_graph(), polyfem::F, polyfem::logger(), V, x, and y.
Referenced by refine_quad_mesh().
| void polyfem::mesh::irregular_tessellation | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F, | ||
| const double | max_edge_length, | ||
| Eigen::MatrixXd & | V_out, | ||
| Eigen::MatrixXi & | F_out | ||
| ) |
Tessilate a triangle mesh (V, F) with well shaped triangles.
| V | vertices |
| F | triangular faces |
| max_edge_length | maximum edge length |
| V_out | tessilated vertices |
| F_out | tessilated faces |
Definition at line 288 of file UpsampleMesh.cpp.
References polyfem::F, irregular_triangle(), max_edge_length(), stitch_mesh(), and V.
| void polyfem::mesh::irregular_triangle | ( | const Eigen::Vector3d & | a, |
| const Eigen::Vector3d & | b, | ||
| const Eigen::Vector3d & | c, | ||
| const double | max_edge_length, | ||
| Eigen::MatrixXd & | V, | ||
| Eigen::MatrixXi & | F | ||
| ) |
Refine a triangle (a, b, c) into a well shaped triangle mesh.
| a | first vertex of the triangle |
| b | second vertex of the triangle |
| c | third vertex of the triangle |
| max_edge_len | maximum edge length of the refined triangle mesh |
| V | vertices of the refined triangle |
| F | faces of the refined triangle |
Definition at line 217 of file UpsampleMesh.cpp.
References polyfem::assembler::cross(), polyfem::F, polyfem::log_and_throw_error(), max_edge_length(), refine_triangle_edges(), polyfem::utils::triangle_area(), V, and z.
Referenced by irregular_tessellation(), and irregular_triangle_barycentric_coordinates().
| void polyfem::mesh::irregular_triangle_barycentric_coordinates | ( | const Eigen::Vector3d & | a, |
| const Eigen::Vector3d & | b, | ||
| const Eigen::Vector3d & | c, | ||
| const double | max_edge_length, | ||
| Eigen::MatrixXd & | UV, | ||
| Eigen::MatrixXi & | F | ||
| ) |
Refine a triangle (a, b, c) into a well shaped triangle mesh.
| a | first vertex of the triangle |
| b | second vertex of the triangle |
| c | third vertex of the triangle |
| max_edge_len | maximum edge length of the refined triangle mesh |
| UV | barycentric coordinates of the refined triangle |
| F | faces of the refined triangle |
Definition at line 266 of file UpsampleMesh.cpp.
References polyfem::F, irregular_triangle(), max_edge_length(), and V.
Referenced by build_collision_proxy().
| int polyfem::mesh::is_inside | ( | const Eigen::MatrixXd & | IV, |
| const Eigen::MatrixXd & | Q, | ||
| std::vector< bool > & | inside | ||
| ) |
Compute whether points are inside a polygon.
| [in] | IV | #IV x 2 of vertex positions for the input polygon |
| [in] | Q | #Q x 2 of query point positions |
| [out] | inside | Whether the i-th query point is inside or not |
Definition at line 256 of file PolygonUtils.cpp.
| bool polyfem::mesh::is_planar | ( | const Eigen::MatrixXd & | V, |
| const double | tol = 1e-5 |
||
| ) |
Determine if the given V x (2|3) vertices are planar (2D or z-range below tol).
Definition at line 26 of file MeshUtils.cpp.
References V.
| bool polyfem::mesh::is_star_shaped | ( | const Eigen::MatrixXd & | IV, |
| Eigen::RowVector3d & | bary | ||
| ) |
Determine whether a polygon is star-shaped or not.
| [in] | IV | #IV x (2|3) of vertex positions around the polygon |
| [out] | bary | Area centroid of the kernel, or vertex mean for a degenerate kernel |
Definition at line 158 of file PolygonUtils.cpp.
References compute_visibility_kernel(), and polyfem::assembler::cross().
Referenced by polyfem::mesh::Polygons::catmul_clark_split(), and polyfem::mesh::Polygons::polar_split().
| double polyfem::mesh::line_weight | ( | const Eigen::Matrix< double, 2, 2 > & | e, |
| const InlineVector< double, 3 > & | v | ||
| ) |
Definition at line 444 of file NCMesh2D.cpp.
Referenced by polyfem::mesh::NCMesh2D::build_element_vertex_adjacency().
| void polyfem::mesh::load_collision_proxy | ( | const io::ResourceIO & | resources, |
| const std::string & | mesh_filename, | ||
| const std::string & | weights_filename, | ||
| const Eigen::VectorXi & | in_node_to_node, | ||
| const json & | transformation, | ||
| Eigen::MatrixXd & | vertices, | ||
| Eigen::VectorXi & | codim_vertices, | ||
| Eigen::MatrixXi & | edges, | ||
| Eigen::MatrixXi & | faces, | ||
| std::vector< Eigen::Triplet< double > > & | displacement_map_entries | ||
| ) |
Load a collision proxy mesh and displacement map from resources.
| [in] | mesh_filename | Mesh resource path |
| [in] | weights_filename | Weights resource path |
| [in] | in_node_to_node | Map from input node IDs to node IDs |
| [in] | transformation | Transformation to apply to the mesh |
| [out] | vertices | Output vertices of the proxy mesh |
| [out] | codim_vertices | Output codimension vertices of the proxy mesh |
| [out] | edges | Output edges of the proxy mesh |
| [out] | faces | Output faces of the proxy mesh |
| [out] | displacement_map_entries | Output displacement map entries |
Definition at line 320 of file CollisionProxy.cpp.
References faces, load_collision_proxy(), load_collision_proxy_displacement_map(), and load_collision_proxy_mesh().
Referenced by polyfem::varform::NonlinearElasticVarForm::build_collision_mesh(), and load_collision_proxy().
| void polyfem::mesh::load_collision_proxy_displacement_map | ( | const io::ResourceIO & | resources, |
| const std::string & | weights_filename, | ||
| const Eigen::VectorXi & | in_node_to_node, | ||
| const size_t | num_proxy_vertices, | ||
| std::vector< Eigen::Triplet< double > > & | displacement_map_entries | ||
| ) |
Load a collision proxy displacement map from a resource.
| [in] | weights_filename | Weights resource path |
| [in] | in_node_to_node | Map from input node IDs to node IDs |
| [out] | displacement_map_entries | Output displacement map entries |
Definition at line 378 of file CollisionProxy.cpp.
References polyfem::io::ResourceIO::is_group(), load_collision_proxy_displacement_map(), polyfem::log_and_throw_error(), polyfem::io::ResourceIO::materialize(), polyfem::io::ResourceIO::read_double_vector(), polyfem::io::ResourceIO::read_int_vector(), polyfem::io::ResourceIO::read_shape_attribute(), and weights.
Referenced by load_collision_proxy(), and load_collision_proxy_displacement_map().
| void polyfem::mesh::load_collision_proxy_mesh | ( | const io::ResourceIO & | resources, |
| const std::string & | mesh_filename, | ||
| const json & | transformation, | ||
| Eigen::MatrixXd & | vertices, | ||
| Eigen::VectorXi & | codim_vertices, | ||
| Eigen::MatrixXi & | edges, | ||
| Eigen::MatrixXi & | faces | ||
| ) |
Load a collision proxy mesh from a resource.
| [in] | mesh_filename | Mesh resource path |
| [in] | transformation | Transformation to apply to the mesh |
| [out] | vertices | Output vertices of the proxy mesh |
| [out] | codim_vertices | Output codimension vertices of the proxy mesh |
| [out] | edges | Output edges of the proxy mesh |
| [out] | faces | Output faces of the proxy mesh |
Definition at line 336 of file CollisionProxy.cpp.
References polyfem::mesh::SurfaceMeshData::edges, faces, polyfem::mesh::SurfaceMeshData::faces, load_collision_proxy_mesh(), polyfem::mesh::MeshLoader::load_surface(), polyfem::mesh::SurfaceMeshData::points, and polyfem::mesh::SurfaceMeshData::vertices.
Referenced by load_collision_proxy(), and load_collision_proxy_mesh().
| double polyfem::mesh::max_edge_length | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F | ||
| ) |
Compute the maximum edge length of a triangle mesh (V, F)
| V | vertices |
| F | triangular faces |
Definition at line 87 of file UpsampleMesh.cpp.
References polyfem::F, max_edge_length(), and V.
Referenced by build_collision_proxy(), irregular_tessellation(), irregular_triangle(), irregular_triangle_barycentric_coordinates(), max_edge_length(), refine_edge(), and regular_grid_tessellation().
| int polyfem::mesh::mesh_create_vertex | ( | PolygonMesh & | M, |
| const PolygonMesh::Point & | p | ||
| ) |
Definition at line 58 of file MeshUtils.cpp.
Referenced by refine_polygonal_mesh(), and refine_triangle_mesh().
| polyfem::mesh::PolygonMesh::Point polyfem::mesh::mesh_vertex | ( | const PolygonMesh & | M, |
| int | v | ||
| ) |
Retrieve a 3D vector with the position of a given vertex.
| [in] | M | Input mesh |
| [in] | v | Vertex index whose position to retrieve |
Definition at line 39 of file MeshUtils.cpp.
Referenced by facet_barycenter(), refine_polygonal_mesh(), and refine_triangle_mesh().
| polyfem::mesh::NLOHMANN_JSON_SERIALIZE_ENUM | ( | CollisionProxyTessellation | , |
| {{CollisionProxyTessellation::REGULAR, "regular"}, {CollisionProxyTessellation::IRREGULAR, "irregular"}} | |||
| ) |
| void polyfem::mesh::offset_polygon | ( | const Eigen::MatrixXd & | IV, |
| Eigen::MatrixXd & | OV, | ||
| double | eps | ||
| ) |
Compute offset polygon.
| [in] | IV | #IV x 2 of vertex positions for the input polygon |
| [out] | OV | #OV x 2 of vertex positions for the offset polygon |
| [in] | eps | Offset distance |
Definition at line 192 of file PolygonUtils.cpp.
| void polyfem::mesh::offset_surface_vertices | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F, | ||
| const Eigen::RowVector3d & | interior_point, | ||
| double | distance, | ||
| Eigen::MatrixXd & | offset | ||
| ) |
Offset along area-weighted surface normals, using the direction away from an interior point where incident normals cancel.
Definition at line 334 of file MeshUtils.cpp.
| std::ostream & polyfem::mesh::operator<< | ( | std::ostream & | os, |
| const LocalBoundary & | lb | ||
| ) |
| os | Output stream |
| lb | LocalBoundary to print |
Definition at line 50 of file LocalBoundary.cpp.
| void polyfem::mesh::orient_closed_surface | ( | const Eigen::MatrixXd & | V, |
| Eigen::MatrixXi & | F, | ||
| bool | positive = true |
||
| ) |
Orient a triangulated surface to have positive volume.
| [in] | V | V x 3 input mesh vertices |
| [in] | F | F x 3 input mesh facets |
| [in] | positive | Orient for positive volume, or negative volume |
Definition at line 813 of file MeshUtils.cpp.
References F, signed_volume(), and V.
Referenced by polyfem::basis::PolygonalBasis3d::build_bases().
| void polyfem::mesh::orient_normals_2d | ( | PolygonMesh & | M | ) |
Orient facets of a 2D mesh so that each connected component has positive volume.
| [in,out] | M | Surface mesh to reorient |
Definition at line 272 of file MeshUtils.cpp.
Referenced by polyfem::mesh::CMesh2D::build_topology().
| double polyfem::mesh::point_triangle_squared_distance | ( | const double * | p, |
| const double * | v0, | ||
| const double * | v1, | ||
| const double * | v2 | ||
| ) |
Squared distance between a point and a triangle.
David Eberly's algorithm (https://www.geometrictools.com), with the exact expressions of geogram's Geom::point_triangle_squared_distance, which PolyFEM used to call through geogram's facet AABB. Like geogram, this file is compiled without floating-point contraction (see CMakeLists.txt), so the results are identical to the former ones.
| [in] | p | Query point (3 coordinates) |
| [in] | v0,v1,v2 | Triangle vertices (3 coordinates each) |
Definition at line 284 of file PointTriangleDistance.cpp.
References point_triangle_squared_distance().
Referenced by point_triangle_squared_distance().
| Eigen::MatrixXd polyfem::mesh::refine_edge | ( | const VectorNd & | a, |
| const VectorNd & | b, | ||
| const double | max_edge_length | ||
| ) |
Refine an edge (a, b) so each refined edge has length at most max_edge_length.
| a | first vertex of the edge |
| b | second vertex of the edge |
| max_edge_length | maximum edge length |
Definition at line 183 of file UpsampleMesh.cpp.
References max_edge_length(), and V.
Referenced by refine_triangle_edges().
|
inline |
Definition at line 137 of file Refinement.hpp.
References polyfem::mesh::Polygons::no_split_func(), polyfem::mesh::Polygons::polar_split_func(), and refine_polygonal_mesh().
| void polyfem::mesh::refine_polygonal_mesh | ( | const PolygonMesh & | M_in, |
| PolygonMesh & | M_out, | ||
| Polygons::SplitFunction | split_func | ||
| ) |
Refine a polygonal mesh.
Quads and triangles are split into quads. If refine_polygons is set to true, then polygonal facets are also split into a layer of padding quads, and a new polygon is created around the barycenter
| [in] | M_in | Surface mesh to subdivide |
| [out] | M_out | Refined mesh |
| [in] | split_func | Functional used to split the new polygon interiors (boundary has already been split) |
Definition at line 613 of file Refinement.cpp.
References polyfem::mesh::PolygonMesh::clear_edges(), polyfem::mesh::PolygonMesh::clear_facets(), polyfem::mesh::PolygonMesh::create_polygon(), polyfem::mesh::Navigation::Index::edge, polyfem::F, facet_barycenter(), polyfem::mesh::PolygonMesh::facet_vertex(), polyfem::mesh::Navigation::get_index_from_face(), mesh_create_vertex(), mesh_vertex(), polyfem::mesh::PolygonMesh::n_edges(), polyfem::mesh::PolygonMesh::n_facet_vertices(), polyfem::mesh::PolygonMesh::n_facets(), polyfem::mesh::PolygonMesh::n_vertices(), polyfem::mesh::Navigation::next_around_face(), polyfem::mesh::Navigation::switch_edge(), polyfem::mesh::Navigation::switch_vertex(), and V.
Referenced by polyfem::mesh::CMesh2D::refine(), and refine_polygonal_mesh().
| void polyfem::mesh::refine_quad_mesh | ( | const Eigen::MatrixXd & | IV, |
| const Eigen::MatrixXi & | IF, | ||
| Eigen::MatrixXd & | OV, | ||
| Eigen::MatrixXi & | OF | ||
| ) |
Definition at line 502 of file Refinement.cpp.
References instantiate_pattern().
| void polyfem::mesh::refine_triangle_edges | ( | const VectorNd & | a, |
| const VectorNd & | b, | ||
| const VectorNd & | c, | ||
| const double | max_edge_len, | ||
| Eigen::MatrixXd & | V, | ||
| Eigen::MatrixXi & | E | ||
| ) |
Refine the edges of a triangle (a, b, c) so each refined edge has length at most max_edge_length.
| a | first vertex of the triangle |
| b | second vertex of the triangle |
| c | third vertex of the triangle |
| max_edge_len | maximum edge length |
| V | vertices of the refined edges |
| E | refined edges |
Definition at line 194 of file UpsampleMesh.cpp.
References refine_edge(), and V.
Referenced by irregular_triangle().
| void polyfem::mesh::refine_triangle_mesh | ( | const PolygonMesh & | M_in, |
| PolygonMesh & | M_out | ||
| ) |
Refine a triangle mesh.
Each input triangle is split into 4 new triangles
| [in] | M_in | Input surface mesh |
| [out] | M_out | Output surface mesh |
Definition at line 739 of file Refinement.cpp.
References polyfem::mesh::PolygonMesh::clear_edges(), polyfem::mesh::PolygonMesh::clear_facets(), polyfem::mesh::PolygonMesh::create_polygon(), polyfem::mesh::Navigation::Index::edge, polyfem::mesh::PolygonMesh::facet_vertex(), polyfem::mesh::Navigation::get_index_from_face(), mesh_create_vertex(), mesh_vertex(), polyfem::mesh::PolygonMesh::n_edges(), polyfem::mesh::PolygonMesh::n_facet_vertices(), polyfem::mesh::PolygonMesh::n_facets(), polyfem::mesh::PolygonMesh::n_vertices(), polyfem::mesh::Navigation::next_around_face(), polyfem::mesh::Navigation::switch_edge(), and polyfem::mesh::Navigation::switch_vertex().
Referenced by polyfem::mesh::CMesh2D::refine().
| void polyfem::mesh::regular_grid_tessellation | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F, | ||
| const double | max_edge_length, | ||
| Eigen::MatrixXd & | V_out, | ||
| Eigen::MatrixXi & | F_out | ||
| ) |
Tessilate a triangle mesh (V, F) with regular grids of triangles of maximum edge length.
| V | vertices |
| F | triangular faces |
| max_edge_length | maximum edge length |
| V_out | tessilated vertices |
| F_out | tessilated faces |
Definition at line 148 of file UpsampleMesh.cpp.
References polyfem::F, max_edge_length(), regular_grid_triangle_barycentric_coordinates(), stitch_mesh(), and V.
| void polyfem::mesh::regular_grid_triangle_barycentric_coordinates | ( | const int | n, |
| Eigen::MatrixXd & | V, | ||
| Eigen::MatrixXi & | F | ||
| ) |
Compute the barycentric coordinates of a regular grid of triangles.
| [in] | n | Number of triangles along each edge |
| [out] | V | Vertices of the regular grid |
| [out] | F | Faces of the regular grid |
Definition at line 104 of file UpsampleMesh.cpp.
References polyfem::F, and V.
Referenced by build_collision_proxy(), and regular_grid_tessellation().
| void polyfem::mesh::reorder_mesh | ( | Eigen::MatrixXd & | V, |
| Eigen::MatrixXi & | F, | ||
| const Eigen::VectorXi & | C, | ||
| Eigen::VectorXi & | R | ||
| ) |
Reorder vertices of a mesh using color tags, so that vertices are ordered by increasing colors.
| [in,out] | V | V x d input mesh vertices |
| [in,out] | F | F x k input mesh faces |
| [in] | C | V per vertex color tag |
| [out] | R | max(C)+1 vector of starting indices for each colors (last value is the total number of vertices) |
Definition at line 292 of file MeshUtils.cpp.
| void polyfem::mesh::sample_polygon | ( | const Eigen::MatrixXd & | IV, |
| int | num_samples, | ||
| Eigen::MatrixXd & | S | ||
| ) |
Sample equal-arclength interval midpoints, starting at the lexicographically smallest polygon vertex.
| [in] | IV | #IV x 2 vertex positions for the input polygon |
| [in] | num_samples | Desired number of samples |
| [out] | S | #S x 2 output sample positions |
Definition at line 278 of file PolygonUtils.cpp.
Referenced by polyfem::basis::PolygonalBasis2d::build_bases().
| void polyfem::mesh::signed_squared_distances | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F, | ||
| const Eigen::MatrixXd & | P, | ||
| Eigen::VectorXd & | D | ||
| ) |
Computes the signed squared distance from a list of points to a triangle mesh.
This function build a AABB tree of the input mesh, computes the distance for each query point to the closest triangle, and then determines the sign by casting a vertical ray from the query point and counting the number of intersections with the input mesh
| [in] | V | V x 3 input mesh vertices |
| [in] | F | F x 3 input mesh faces |
| [in] | P | #P x 3 query points |
| D | #P x 1 computed signed distances, negative inside, positive outside |
Definition at line 765 of file MeshUtils.cpp.
| double polyfem::mesh::signed_volume | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F | ||
| ) |
Compute the signed volume of a surface mesh.
Definition at line 792 of file MeshUtils.cpp.
Referenced by orient_closed_surface(), and polyfem::mesh::MeshProcessing3D::refine_red_refinement_tet().
| void polyfem::mesh::stitch_mesh | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F, | ||
| const std::vector< Eigen::Triplet< double > > & | W, | ||
| Eigen::MatrixXd & | V_out, | ||
| Eigen::MatrixXi & | F_out, | ||
| std::vector< Eigen::Triplet< double > > & | W_out, | ||
| const double | epsilon = 1e-5 |
||
| ) |
Stitch a triangle mesh (V, F) together by removing duplicate vertices.
Also removes weights in W that correspond to duplicate vertices.
| [in] | V | Input vertices |
| [in] | F | Input faces |
| [in] | W | Input weights |
| [out] | V_out | Output vertices (duplicate vertices removed) |
| [out] | F_out | Output faces (updated to use V_out) |
| [out] | W_out | Output weights (updated to use V_out) |
| [in] | epsilon | Tolerance for duplicate vertices |
indices: #V_out by 1 list of indices so V_out = V(indices,:) inverse: V by 1 list of indices so V = V_out(inverse,:)
Definition at line 46 of file UpsampleMesh.cpp.
References polyfem::F, polyfem::utils::inverse(), and V.
| void polyfem::mesh::stitch_mesh | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F, | ||
| Eigen::MatrixXd & | V_out, | ||
| Eigen::MatrixXi & | F_out, | ||
| const double | epsilon = 1e-5 |
||
| ) |
Stitch a triangle mesh (V, F) together by removing duplicate vertices.
| [in] | V | Input vertices |
| [in] | F | Input faces |
| [out] | V_out | Output vertices (duplicate vertices removed) |
| [out] | F_out | Output faces (updated to use V_out) |
| [in] | epsilon | Tolerance for duplicate vertices |
Definition at line 35 of file UpsampleMesh.cpp.
References polyfem::F, stitch_mesh(), and V.
Referenced by build_collision_proxy(), irregular_tessellation(), regular_grid_tessellation(), and stitch_mesh().
|
inlineconstexpr |
The canonical typed mesh schema shared by HDF5 bundles and checkpoints.
Definition at line 10 of file MeshLoader.hpp.
Referenced by polyfem::mesh::MeshLoader::validate_group(), and polyfem::io::CheckpointWriter::write_mesh().