PolyFEM
Loading...
Searching...
No Matches
MeshUtils.hpp File Reference
#include <polyfem/mesh/Mesh.hpp>
#include <polyfem/mesh/mesh3D/Mesh3D.hpp>
#include <geogram/mesh/mesh.h>
#include <Eigen/Dense>
#include <vector>
#include <memory>
Include dependency graph for MeshUtils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  polyfem
 
namespace  polyfem::mesh
 

Functions

GEO::vec3 polyfem::mesh::mesh_vertex (const GEO::Mesh &M, GEO::index_t v)
 Retrieve a 3D vector with the position of a given vertex.
 
GEO::vec3 polyfem::mesh::facet_barycenter (const GEO::Mesh &M, GEO::index_t f)
 
GEO::index_t polyfem::mesh::mesh_create_vertex (GEO::Mesh &M, const GEO::vec3 &p)
 
void polyfem::mesh::compute_element_tags (const GEO::Mesh &M, std::vector< ElementType > &element_tags)
 Compute the type of each facet in a surface mesh.
 
void polyfem::mesh::orient_normals_2d (GEO::Mesh &M)
 Orient facets of a 2D mesh so that each connected component has positive volume.
 
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.
 
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.
 
void polyfem::mesh::to_geogram_mesh (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, GEO::Mesh &M)
 Converts a triangle mesh to a Geogram mesh.
 
void polyfem::mesh::from_geogram_mesh (const GEO::Mesh &M, Eigen::MatrixXd &V, Eigen::MatrixXi &F, Eigen::MatrixXi &T)
 Extract simplices from a Geogram mesh.
 
void polyfem::mesh::to_geogram_mesh (const Mesh3D &mesh, GEO::Mesh &M)
 Converts a hex mesh to a Geogram mesh.
 
double polyfem::mesh::signed_volume (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F)
 Compute the signed volume of a surface mesh.
 
void polyfem::mesh::orient_closed_surface (const Eigen::MatrixXd &V, Eigen::MatrixXi &F, bool positive=true)
 Orient a triangulated surface to have positive volume.
 
void polyfem::mesh::extract_polyhedra (const Mesh3D &mesh, std::vector< std::unique_ptr< GEO::Mesh > > &polys, bool triangulated=false)
 Extract polyhedra from a 3D volumetric mesh.
 
void polyfem::mesh::tertrahedralize_star_shaped_surface (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, const Eigen::RowVector3d &kernel, Eigen::MatrixXd &OV, Eigen::MatrixXi &OF, Eigen::MatrixXi &OT)
 Tetrahedralize a star-shaped mesh, with a given point in its kernel.
 
void polyfem::mesh::sample_surface (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, int num_samples, Eigen::MatrixXd &P, Eigen::MatrixXd *N=nullptr, int num_lloyd=10, int num_newton=10)
 Samples points on a surface.
 
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.
 
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.
 
bool polyfem::mesh::read_surface_mesh (const std::string &mesh_path, Eigen::MatrixXd &vertices, Eigen::VectorXi &codim_vertices, Eigen::MatrixXi &codim_edges, Eigen::MatrixXi &faces)
 read a surface mesh
 
bool polyfem::mesh::is_planar (const GEO::Mesh &M, const double tol=1e-5)
 Determine if the given mesh is planar (2D or tiny z-range).
 
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)
 
void polyfem::mesh::generate_edges (GEO::Mesh &M)
 assing edges to M