Lagrange
|
Various attribute processing utilities. More...
Classes | |
struct | FacetAreaOptions |
Option struct for computing per-facet area. More... | |
struct | MeshAreaOptions |
Option struct for computing mesh area. More... | |
struct | FacetCentroidOptions |
Option struct for computing per-facet centroid. More... | |
struct | MeshCentroidOptions |
Option struct for computing mesh centroid. More... | |
struct | ComponentOptions |
Options to control connected components computation. More... | |
struct | DihedralAngleOptions |
Option struct for computing dihedral angles. More... | |
struct | DijkstraDistanceOptions< Scalar, Index > |
Option struct for compute_dijkstra_distance. More... | |
struct | EdgeLengthOptions |
struct | FacetNormalOptions |
Option struct for computing per-facet mesh normals. More... | |
struct | GreedyColoringOptions |
Option struct for computing dihedral angles. More... | |
struct | NormalOptions |
Option struct for computing indexed mesh normals. More... | |
struct | TangentBitangentOptions |
Option struct for computing tangent and bitangent vectors. More... | |
struct | TangentBitangentResult |
Result type of the compute_tangent_bitangent function. More... | |
struct | UVDistortionOptions |
Option struct for compute uv distortion. More... | |
struct | VertexNormalOptions |
Option struct for computing per-vertex mesh normals. More... | |
struct | VertexValenceOptions |
Option struct for computing vertex valence. More... | |
struct | CornerNormalOptions |
Option struct for computing per-corner mesh normals. More... | |
struct | SubmeshOptions |
Options for extract submesh. More... | |
struct | AttributeFilter |
Helper object to filter attributes based on name, id, usage or element type. More... | |
struct | AttributeMatcher |
Helper object to match attributes based on usage, element type, and number of channels. More... | |
struct | OrientationOptions |
Option struct for computing if edges are oriented. More... | |
struct | RemapVerticesOptions |
Remap vertices options. More... | |
struct | Frustum< Scalar > |
An array of four planes that define a frustum. More... | |
struct | FrustumSelectionOptions |
Option struct for selecting facets. More... | |
struct | SeparateByComponentsOptions |
Option settings for separate_by_components . More... | |
struct | SeparateByFacetGroupsOptions |
Option settings for separate_by_facet_groups . More... | |
struct | VertexManifoldOptions |
Option struct for computing manifold flags. More... | |
struct | TransformOptions |
Options available when applying affine transforms to a mesh. More... | |
Enumerations | |
enum class | DistortionMetric { Dirichlet , InverseDirichlet , SymmetricDirichlet , AreaRatio , MIPS } |
UV distortion metric type. More... | |
enum class | NormalWeightingType : char { Uniform = 0 , CornerTriangleArea = 1 , Angle = 2 } |
Weighting types for averaging corner normals around a vertex. More... | |
Functions | |
template<typename ToScalar , typename ToIndex , typename FromScalar , typename FromIndex > | |
SurfaceMesh< ToScalar, ToIndex > | cast (const SurfaceMesh< FromScalar, FromIndex > &source_mesh, const AttributeFilter &convertible_attributes={}, std::vector< std::string > *converted_attributes_names=nullptr) |
Cast a mesh to a mesh of different scalar and/or index type. More... | |
template<typename ToValueType , typename Scalar , typename Index > | |
AttributeId | cast_attribute (SurfaceMesh< Scalar, Index > &mesh, AttributeId source_id, std::string_view target_name) |
Cast an attribute in place to a different value type. More... | |
template<typename ToValueType , typename Scalar , typename Index > | |
AttributeId | cast_attribute (SurfaceMesh< Scalar, Index > &mesh, std::string_view source_name, std::string_view target_name) |
Cast an attribute in place to a different value type. More... | |
template<typename ToValueType , typename Scalar , typename Index > | |
AttributeId | cast_attribute_in_place (SurfaceMesh< Scalar, Index > &mesh, AttributeId attribute_id) |
Cast an attribute in place to a different value type. More... | |
template<typename ToValueType , typename Scalar , typename Index > | |
AttributeId | cast_attribute_in_place (SurfaceMesh< Scalar, Index > &mesh, std::string_view name) |
Cast an attribute in place to a different value type. More... | |
template<typename Scalar , typename Index > | |
SurfaceMesh< Scalar, Index > | combine_meshes (std::initializer_list< const SurfaceMesh< Scalar, Index > * > meshes, bool preserve_attributes=true) |
Combine multiple meshes into a single mesh. More... | |
template<typename Scalar , typename Index > | |
SurfaceMesh< Scalar, Index > | combine_meshes (span< const SurfaceMesh< Scalar, Index > > meshes, bool preserve_attributes=true) |
Combine multiple meshes into a single mesh. More... | |
template<typename Scalar , typename Index > | |
SurfaceMesh< Scalar, Index > | combine_meshes (size_t num_meshes, function_ref< const SurfaceMesh< Scalar, Index > &(size_t)> get_mesh, bool preserve_attributes=true) |
Combine multiple meshes into a single mesh. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_facet_area (SurfaceMesh< Scalar, Index > &mesh, FacetAreaOptions options={}) |
Compute per-facet area. More... | |
template<typename Scalar , typename Index , int Dimension> | |
AttributeId | compute_facet_area (SurfaceMesh< Scalar, Index > &mesh, const Eigen::Transform< Scalar, Dimension, Eigen::Affine > &transformation, FacetAreaOptions options={}) |
Compute per-facet area. More... | |
template<typename Scalar , typename Index > | |
Scalar | compute_mesh_area (const SurfaceMesh< Scalar, Index > &mesh, MeshAreaOptions options={}) |
Compute mesh area. More... | |
template<typename Scalar , typename Index , int Dimension> | |
Scalar | compute_mesh_area (const SurfaceMesh< Scalar, Index > &mesh, const Eigen::Transform< Scalar, Dimension, Eigen::Affine > &transformation, MeshAreaOptions options={}) |
Compute mesh area. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_facet_centroid (SurfaceMesh< Scalar, Index > &mesh, FacetCentroidOptions options={}) |
Compute per-facet centroid. More... | |
template<typename Scalar , typename Index > | |
void | compute_mesh_centroid (const SurfaceMesh< Scalar, Index > &mesh, span< Scalar > centroid, MeshCentroidOptions options={}) |
Compute mesh centroid, where mesh centroid is defined as the weighted sum of facet centroids. More... | |
template<typename Scalar , typename Index > | |
size_t | compute_components (SurfaceMesh< Scalar, Index > &mesh, ComponentOptions options={}) |
Compute connected components of an input mesh. More... | |
template<typename Scalar , typename Index > | |
size_t | compute_components (SurfaceMesh< Scalar, Index > &mesh, span< const Index > blocker_elements, ComponentOptions options={}) |
Compute connected components of an input mesh. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_dihedral_angles (SurfaceMesh< Scalar, Index > &mesh, const DihedralAngleOptions &options={}) |
Computes dihedral angles for each edge in the mesh. More... | |
template<typename Scalar , typename Index > | |
std::optional< std::vector< Index > > | compute_dijkstra_distance (SurfaceMesh< Scalar, Index > &mesh, const DijkstraDistanceOptions< Scalar, Index > &options={}) |
Computes dijkstra distance from a seed facet. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_edge_lengths (SurfaceMesh< Scalar, Index > &mesh, const EdgeLengthOptions &options={}) |
Computes edge lengths attribute. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_facet_normal (SurfaceMesh< Scalar, Index > &mesh, FacetNormalOptions options={}) |
Compute facet normals. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_greedy_coloring (SurfaceMesh< Scalar, Index > &mesh, const GreedyColoringOptions &options={}) |
Compute a greedy graph coloring of the mesh. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_normal (SurfaceMesh< Scalar, Index > &mesh, function_ref< bool(Index)> is_edge_smooth, span< const Index > cone_vertices={}, NormalOptions options={}) |
Compute smooth normals based on specified sharp edges and cone vertices. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_normal (SurfaceMesh< Scalar, Index > &mesh, function_ref< bool(Index, Index)> is_edge_smooth, span< const Index > cone_vertices={}, NormalOptions options={}) |
Compute smooth normals based on specified sharp edges and cone vertices. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_normal (SurfaceMesh< Scalar, Index > &mesh, Scalar feature_angle_threshold, span< const Index > cone_vertices={}, NormalOptions options={}) |
Compute smooth normal based on specified dihedral angle threshold and cone vertices. More... | |
template<typename Scalar , typename Index > | |
TangentBitangentResult | compute_tangent_bitangent (SurfaceMesh< Scalar, Index > &mesh, TangentBitangentOptions options={}) |
Compute mesh tangent and bitangent vectors orthogonal to the input mesh normals. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_uv_distortion (SurfaceMesh< Scalar, Index > &mesh, const UVDistortionOptions &options={}) |
Compute uv distortion using the selected distortion measure. More... | |
template<typename Scalar , typename Index > | |
std::vector< std::pair< int32_t, int32_t > > | compute_uv_tile_list (const SurfaceMesh< Scalar, Index > &mesh) |
Extract the list of all UV tiles that a mesh's parametrization spans. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_vertex_normal (SurfaceMesh< Scalar, Index > &mesh, VertexNormalOptions options={}) |
Compute per-vertex normals based on specified weighting type. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_vertex_valence (SurfaceMesh< Scalar, Index > &mesh, VertexValenceOptions options={}) |
Compute vertex valence. More... | |
template<typename Scalar , typename Index > | |
AdjacencyList< Index > | compute_vertex_vertex_adjacency (SurfaceMesh< Scalar, Index > &mesh) |
Compute vertex-vertex adjacency information. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_weighted_corner_normal (SurfaceMesh< Scalar, Index > &mesh, CornerNormalOptions option={}) |
Compute corner normals. More... | |
template<typename Scalar , typename Index , typename DerivedV , typename DerivedF > | |
SurfaceMesh< Scalar, Index > | eigen_to_surface_mesh (const Eigen::MatrixBase< DerivedV > &V, const Eigen::MatrixBase< DerivedF > &F) |
Create a SurfaceMesh from a igl-style pair of matrices (V, F). More... | |
template<typename Scalar , typename Index > | |
std::vector< std::vector< Index > > | extract_boundary_loops (const SurfaceMesh< Scalar, Index > &mesh) |
Extract boundary loops from a surface mesh. More... | |
template<typename Scalar , typename Index > | |
SurfaceMesh< Scalar, Index > | extract_submesh (const SurfaceMesh< Scalar, Index > &mesh, span< const Index > selected_facets, const SubmeshOptions &options={}) |
Extract a submesh that consists of a subset of the facets of the source mesh. More... | |
template<typename Scalar , typename Index > | |
std::vector< AttributeId > | filtered_attribute_ids (const SurfaceMesh< Scalar, Index > &mesh, const AttributeFilter &options) |
Create a list of attribute ids corresponding to the given filter. More... | |
template<typename Scalar , typename Index > | |
SurfaceMesh< Scalar, Index > | filter_attributes (SurfaceMesh< Scalar, Index > source_mesh, const AttributeFilter &options={}) |
Filters the attributes of mesh according to user specifications. More... | |
template<typename Scalar , typename Index > | |
std::optional< AttributeId > | find_matching_attribute (const SurfaceMesh< Scalar, Index > &mesh, const AttributeMatcher &options) |
Finds the first attribute with the specified usage/element type/number of channels. More... | |
template<typename Scalar , typename Index > | |
std::optional< AttributeId > | find_matching_attribute (const SurfaceMesh< Scalar, Index > &mesh, AttributeUsage usage) |
template<typename Scalar , typename Index > | |
std::optional< AttributeId > | find_matching_attribute (const SurfaceMesh< Scalar, Index > &mesh, BitField< AttributeElement > element_types) |
template<typename Scalar , typename Index > | |
std::vector< AttributeId > | find_matching_attributes (const SurfaceMesh< Scalar, Index > &mesh, const AttributeMatcher &options) |
Finds all attributes with the specified usage/element type/number of channels. More... | |
template<typename Scalar , typename Index > | |
std::vector< AttributeId > | find_matching_attributes (const SurfaceMesh< Scalar, Index > &mesh, AttributeUsage usage) |
Finds all attributes with the specified usage. More... | |
template<typename Scalar , typename Index > | |
std::vector< AttributeId > | find_matching_attributes (const SurfaceMesh< Scalar, Index > &mesh, BitField< AttributeElement > element_types) |
Finds all attributes with the specified element types. More... | |
template<typename Scalar , typename Index , typename MeshType > | |
SurfaceMesh< Scalar, Index > | to_surface_mesh_copy (const MeshType &mesh) |
Convert a legacy mesh object to a surface mesh object. More... | |
template<typename Scalar , typename Index , typename MeshType > | |
SurfaceMesh< Scalar, Index > | to_surface_mesh_wrap (MeshType &&mesh) |
Wrap a legacy mesh object as a surface mesh object. More... | |
template<typename MeshType , typename Scalar , typename Index > | |
std::unique_ptr< MeshType > | to_legacy_mesh (const SurfaceMesh< Scalar, Index > &mesh) |
Convert a surface mesh object to a legacy mesh object. More... | |
template<typename Scalar , typename Index > | |
void | normalize_mesh (SurfaceMesh< Scalar, Index > &mesh) |
Normalize a mesh to fit in a unit box centered at the origin. More... | |
template<typename Scalar , typename Index > | |
void | normalize_meshes (span< SurfaceMesh< Scalar, Index > * > meshes) |
Normalize a list of meshes to fit in a unit box centered at the origin. More... | |
template<typename Scalar , typename Index > | |
bool | is_oriented (const SurfaceMesh< Scalar, Index > &mesh) |
Check if a mesh is oriented. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_edge_is_oriented (SurfaceMesh< Scalar, Index > &mesh, const OrientationOptions &options={}) |
Compute a mesh attribute indicating whether an edge is oriented. More... | |
template<typename Scalar , typename Index > | |
void | permute_facets (SurfaceMesh< Scalar, Index > &mesh, span< const Index > new_to_old) |
Reorder facets of a mesh based on a given permutation. More... | |
template<typename Scalar , typename Index > | |
void | permute_vertices (SurfaceMesh< Scalar, Index > &mesh, span< const Index > new_to_old) |
Reorder vertices of a mesh based on a given permutation. More... | |
template<typename Scalar , typename Index > | |
void | remap_vertices (SurfaceMesh< Scalar, Index > &mesh, span< const Index > forward_mapping, RemapVerticesOptions options={}) |
Remap vertices of a mesh based on provided forward mapping. More... | |
template<typename Scalar , typename Index > | |
bool | select_facets_in_frustum (SurfaceMesh< Scalar, Index > &mesh, const Frustum< Scalar > &frustum, const FrustumSelectionOptions &options={}) |
Select all facets that intersect the cone/frustrum bounded by 4 planes defined by (n_i, p_i), where n_i is the plane normal and p_i is a point on the plane. More... | |
template<typename Scalar , typename Index > | |
std::vector< SurfaceMesh< Scalar, Index > > | separate_by_components (const SurfaceMesh< Scalar, Index > &mesh, const SeparateByComponentsOptions &options={}) |
Separate a mesh by connected components. More... | |
template<typename Scalar , typename Index > | |
std::vector< SurfaceMesh< Scalar, Index > > | separate_by_facet_groups (const SurfaceMesh< Scalar, Index > &mesh, size_t num_groups, span< const Index > facet_group_indices, const SeparateByFacetGroupsOptions &options={}) |
Extract a set of submeshes based on facet groups. More... | |
template<typename Scalar , typename Index > | |
std::vector< SurfaceMesh< Scalar, Index > > | separate_by_facet_groups (const SurfaceMesh< Scalar, Index > &mesh, span< const Index > facet_group_indices, const SeparateByFacetGroupsOptions &options={}) |
Extract a set of submeshes based on facet groups. More... | |
template<typename Scalar , typename Index > | |
std::vector< SurfaceMesh< Scalar, Index > > | separate_by_facet_groups (const SurfaceMesh< Scalar, Index > &mesh, size_t num_groups, function_ref< Index(Index)> get_facet_group, const SeparateByFacetGroupsOptions &options={}) |
Extract a set of submeshes based on facet groups. More... | |
template<typename Scalar , typename Index > | |
int | compute_euler (const SurfaceMesh< Scalar, Index > &mesh) |
Compute Euler characteristic of a mesh. More... | |
template<typename Scalar , typename Index > | |
bool | is_vertex_manifold (const SurfaceMesh< Scalar, Index > &mesh) |
Check if a mesh is vertex-manifold. More... | |
template<typename Scalar , typename Index > | |
bool | is_edge_manifold (const SurfaceMesh< Scalar, Index > &mesh) |
Check if a mesh is edge-manifold. More... | |
template<typename Scalar , typename Index > | |
bool | is_manifold (const SurfaceMesh< Scalar, Index > &mesh) |
Check if a mesh is both vertex-manifold and edge-manifold. More... | |
template<typename Scalar , typename Index > | |
AttributeId | compute_vertex_is_manifold (SurfaceMesh< Scalar, Index > &mesh, const VertexManifoldOptions &options={}) |
Compute a mesh attribute indicating vertex and edge manifoldness. More... | |
template<typename Scalar , typename Index , int Dimension> | |
void | transform_mesh (SurfaceMesh< Scalar, Index > &mesh, const Eigen::Transform< Scalar, Dimension, Eigen::Affine > &transform, const TransformOptions &options={}) |
Apply an affine transform \( M \) to a mesh in-place. More... | |
template<typename Scalar , typename Index , int Dimension> | |
SurfaceMesh< Scalar, Index > | transformed_mesh (SurfaceMesh< Scalar, Index > mesh, const Eigen::Transform< Scalar, Dimension, Eigen::Affine > &transform, const TransformOptions &options={}) |
Apply an affine transform to a mesh and return the transformed mesh. More... | |
template<typename Scalar , typename Index > | |
void | triangulate_polygonal_facets (SurfaceMesh< Scalar, Index > &mesh) |
Triangulate polygonal facets of a mesh using a prescribed set of rules. More... | |
Various attribute processing utilities.
Various mesh processing utilities.
|
strong |
|
strong |
#include <lagrange/NormalWeightingType.h>
Weighting types for averaging corner normals around a vertex.
SurfaceMesh< ToScalar, ToIndex > cast | ( | const SurfaceMesh< FromScalar, FromIndex > & | source_mesh, |
const AttributeFilter & | convertible_attributes = {} , |
||
std::vector< std::string > * | converted_attributes_names = nullptr |
||
) |
#include <lagrange/cast.h>
Cast a mesh to a mesh of different scalar and/or index type.
[in] | source_mesh | Input mesh. |
[in] | convertible_attributes | Filter to determine which attribute are convertible. |
[out] | converted_attributes_names | Optional output arg storing the list of non-reserved attribute names that were actually converted to a different type. |
ToScalar | Scalar type of the output mesh. |
ToIndex | Index type of the output mesh. |
FromScalar | Scalar type of the input mesh. |
FromIndex | Index type of the input mesh. |
AttributeId cast_attribute | ( | SurfaceMesh< Scalar, Index > & | mesh, |
AttributeId | source_id, | ||
std::string_view | target_name | ||
) |
#include <lagrange/cast_attribute.h>
Cast an attribute in place to a different value type.
This effectively replaces the existing attribute with a new one.
[in,out] | mesh | Input mesh. Modified to replace the attribute being cast. |
[in] | source_id | Id of the source attribute to cast. |
[in] | target_name | Name of the target attribute to be created. |
AttributeId cast_attribute | ( | SurfaceMesh< Scalar, Index > & | mesh, |
std::string_view | source_name, | ||
std::string_view | target_name | ||
) |
#include <lagrange/cast_attribute.h>
Cast an attribute in place to a different value type.
This effectively replaces the existing attribute with a new one.
[in,out] | mesh | Input mesh. Modified to replace the attribute being cast. |
[in] | source_name | Name of the source attribute being cast. |
[in] | target_name | Name of the target attribute to be created. |
AttributeId cast_attribute_in_place | ( | SurfaceMesh< Scalar, Index > & | mesh, |
AttributeId | attribute_id | ||
) |
#include <lagrange/cast_attribute.h>
Cast an attribute in place to a different value type.
This effectively replaces the existing attribute with a new one.
[in,out] | mesh | Input mesh. Modified to replace the attribute being cast. |
[in] | attribute_id | Id of the attribute to cast. |
AttributeId cast_attribute_in_place | ( | SurfaceMesh< Scalar, Index > & | mesh, |
std::string_view | name | ||
) |
#include <lagrange/cast_attribute.h>
Cast an attribute in place to a different value type.
This effectively replaces the existing attribute with a new one.
[in,out] | mesh | Input mesh. Modified to replace the attribute being cast. |
[in] | name | Name of the attribute to cast. |
SurfaceMesh< Scalar, Index > combine_meshes | ( | std::initializer_list< const SurfaceMesh< Scalar, Index > * > | meshes, |
bool | preserve_attributes = true |
||
) |
#include <lagrange/combine_meshes.h>
Combine multiple meshes into a single mesh.
[in] | meshes | The set of input mesh pointers. |
[in] | preserve_attributes | Preserve shared attributes and map them to the output mesh. |
SurfaceMesh< Scalar, Index > combine_meshes | ( | span< const SurfaceMesh< Scalar, Index > > | meshes, |
bool | preserve_attributes = true |
||
) |
#include <lagrange/combine_meshes.h>
Combine multiple meshes into a single mesh.
[in] | meshes | Meshes to combine. |
[in] | preserve_attributes | Preserve shared attributes and map them to the output mesh. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
SurfaceMesh< Scalar, Index > combine_meshes | ( | size_t | num_meshes, |
function_ref< const SurfaceMesh< Scalar, Index > &(size_t)> | get_mesh, | ||
bool | preserve_attributes = true |
||
) |
#include <lagrange/combine_meshes.h>
Combine multiple meshes into a single mesh.
This is the most generic version, where get_mesh(i)
provides the i
th mesh.
[in] | num_meshes | Number of meshes to combine. |
[in] | get_mesh | Retrieve the i-th mesh to combine. |
[in] | preserve_attributes | Preserve shared attributes and map them to the output mesh. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
AttributeId compute_facet_area | ( | SurfaceMesh< Scalar, Index > & | mesh, |
FacetAreaOptions | options = {} |
||
) |
#include <lagrange/compute_area.h>
Compute per-facet area.
[in,out] | mesh | The input mesh. |
[in] | options | The options controlling the computation. |
FacetAreaOptions
AttributeId compute_facet_area | ( | SurfaceMesh< Scalar, Index > & | mesh, |
const Eigen::Transform< Scalar, Dimension, Eigen::Affine > & | transformation, | ||
FacetAreaOptions | options = {} |
||
) |
#include <lagrange/compute_area.h>
Compute per-facet area.
[in,out] | mesh | The input mesh. |
[in] | transformation | Affine transformation to apply on mesh geometry. |
[in] | options | The options controlling the computation. |
FacetAreaOptions
Scalar compute_mesh_area | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
MeshAreaOptions | options = {} |
||
) |
#include <lagrange/compute_area.h>
Compute mesh area.
[in] | mesh | The input mesh. |
[in] | options | The options controlling the computation. |
MeshAreaOptions
Scalar compute_mesh_area | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
const Eigen::Transform< Scalar, Dimension, Eigen::Affine > & | transformation, | ||
MeshAreaOptions | options = {} |
||
) |
#include <lagrange/compute_area.h>
Compute mesh area.
[in] | mesh | The input mesh. |
[in] | transformation | Affine transformation to apply on mesh geometry. |
[in] | options | The options controlling the computation. |
MeshAreaOptions
AttributeId compute_facet_centroid | ( | SurfaceMesh< Scalar, Index > & | mesh, |
FacetCentroidOptions | options = {} |
||
) |
#include <lagrange/compute_centroid.h>
Compute per-facet centroid.
[in,out] | mesh | The input mesh. |
[in] | options | Option settings to control the computation. |
FacetCentroidOptions
void compute_mesh_centroid | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
span< Scalar > | centroid, | ||
MeshCentroidOptions | options = {} |
||
) |
#include <lagrange/compute_centroid.h>
Compute mesh centroid, where mesh centroid is defined as the weighted sum of facet centroids.
[in] | mesh | The input mesh. |
[out] | centroid | The buffer to store centroid coordinates. |
[in] | options | Option settings to control the computation. |
MeshCentroidOptions
size_t compute_components | ( | SurfaceMesh< Scalar, Index > & | mesh, |
ComponentOptions | options = {} |
||
) |
#include <lagrange/compute_components.h>
Compute connected components of an input mesh.
This method will create a per-facet component id in an attribute named ComponentOptions::output_attribute_name
. Each component id is in [0, num_components-1].
mesh | Input mesh. |
options | Options to control component computation. |
ComponentOptions
size_t compute_components | ( | SurfaceMesh< Scalar, Index > & | mesh, |
span< const Index > | blocker_elements, | ||
ComponentOptions | options = {} |
||
) |
#include <lagrange/compute_components.h>
Compute connected components of an input mesh.
This method will create a per-facet component id in an attribute named ComponentOptions::output_attribute_name
. Each component id is in [0, num_components-1].
mesh | Input mesh. |
blocker_elements | An array of blocker element indices. The blocker element index is either a vertex index or an edge index depending on options.connectivity_type . If options.connectivity_type is ConnectivityType::Edge , facets adjacent to a blocker edge are not considered as connected through this edge. If options.connectivity_type is ConnectivityType::Vertex , facets sharing a blocker vertex are not considered as connected through this vertex. If empty, no blocker elements are used. |
options | Options to control component computation. |
ComponentOptions
AttributeId compute_dihedral_angles | ( | SurfaceMesh< Scalar, Index > & | mesh, |
const DihedralAngleOptions & | options = {} |
||
) |
#include <lagrange/compute_dihedral_angles.h>
Computes dihedral angles for each edge in the mesh.
The dihedral angle of an edge is defined as the angle between the normals of two facets adjacent to the edge. The dihedral angle is always in the range \([0, \pi]\) for manifold edges. For boundary edges, the dihedral angle defaults to 0. For non-manifold edges, the dihedral angle is not well-defined and will be set to the special value \( 2\pi \).
[in] | mesh | The input mesh. |
[in] | options | Options for computing dihedral angles. |
std::optional< std::vector< Index > > compute_dijkstra_distance | ( | SurfaceMesh< Scalar, Index > & | mesh, |
const DijkstraDistanceOptions< Scalar, Index > & | options = {} |
||
) |
AttributeId compute_edge_lengths | ( | SurfaceMesh< Scalar, Index > & | mesh, |
const EdgeLengthOptions & | options = {} |
||
) |
AttributeId compute_facet_normal | ( | SurfaceMesh< Scalar, Index > & | mesh, |
FacetNormalOptions | options = {} |
||
) |
#include <lagrange/compute_facet_normal.h>
Compute facet normals.
[in,out] | mesh | The input mesh. |
[in] | options | Optional arguments to control normal generation. |
mesh
as a facet attribute named options.output_attribute_name
.FacetNormalOptions
. AttributeId compute_greedy_coloring | ( | SurfaceMesh< Scalar, Index > & | mesh, |
const GreedyColoringOptions & | options = {} |
||
) |
#include <lagrange/compute_greedy_coloring.h>
Compute a greedy graph coloring of the mesh.
The selected mesh element type (either Vertex or Facet) will be colored in such a way that no two adjacent element share the same color.
[in,out] | mesh | Input mesh to be colored. Modified to compute edge information and the new color attribute. |
[in] | options | Coloring options. |
AttributeId compute_normal | ( | SurfaceMesh< Scalar, Index > & | mesh, |
function_ref< bool(Index)> | is_edge_smooth, | ||
span< const Index > | cone_vertices = {} , |
||
NormalOptions | options = {} |
||
) |
#include <lagrange/compute_normal.h>
Compute smooth normals based on specified sharp edges and cone vertices.
[in] | mesh | The input mesh. |
[in] | is_edge_smooth | Returns true on e if the edge is smooth. |
[in] | cone_vertices | A list of cone vertices. |
[in] | options | Optional arguments to control normal generation. |
NormalOptions
. AttributeId compute_normal | ( | SurfaceMesh< Scalar, Index > & | mesh, |
function_ref< bool(Index, Index)> | is_edge_smooth, | ||
span< const Index > | cone_vertices = {} , |
||
NormalOptions | options = {} |
||
) |
#include <lagrange/compute_normal.h>
Compute smooth normals based on specified sharp edges and cone vertices.
[in] | mesh | The input mesh. |
[in] | is_edge_smooth | Returns true on (fi, fj) if the edge between fi and fj is smooth. Assumes fi and fi are adjacent. |
[in] | cone_vertices | A list of cone vertices. |
[in] | options | Optional arguments to control normal generation. |
NormalOptions
. AttributeId compute_normal | ( | SurfaceMesh< Scalar, Index > & | mesh, |
Scalar | feature_angle_threshold, | ||
span< const Index > | cone_vertices = {} , |
||
NormalOptions | options = {} |
||
) |
#include <lagrange/compute_normal.h>
Compute smooth normal based on specified dihedral angle threshold and cone vertices.
[in] | mesh | The input mesh. |
[in] | feature_angle_threshold | An edge with dihedral angle larger than this threshold is considered as an feature edge. The angle is expressed in radian. |
[in] | cone_vertices | A list of cone vertices. |
[in] | options | Optional arguments to control normal generation. |
NormalOptions
. TangentBitangentResult compute_tangent_bitangent | ( | SurfaceMesh< Scalar, Index > & | mesh, |
TangentBitangentOptions | options = {} |
||
) |
#include <lagrange/compute_tangent_bitangent.h>
Compute mesh tangent and bitangent vectors orthogonal to the input mesh normals.
[in] | mesh | The input mesh. |
[in] | options | Optional arguments to control tangent/bitangent generation. |
TangentBitangentOptions
. AttributeId compute_uv_distortion | ( | SurfaceMesh< Scalar, Index > & | mesh, |
const UVDistortionOptions & | options = {} |
||
) |
#include <lagrange/compute_uv_distortion.h>
Compute uv distortion using the selected distortion measure.
[in] | mesh | The input mesh. |
[in] | options | The computation option settings. |
UVDistortionOptions
. std::vector< std::pair< int32_t, int32_t > > compute_uv_tile_list | ( | const SurfaceMesh< Scalar, Index > & | mesh | ) |
#include <lagrange/compute_uv_tile_list.h>
Extract the list of all UV tiles that a mesh's parametrization spans.
UV tiles are usually understood to be a regular unit grid in UV space. This process thus reads UV for all vertices of the input mesh, and adds an entry to the output for each new integer pair that it finds.
mesh | Mesh to be analyzed |
AttributeId compute_vertex_normal | ( | SurfaceMesh< Scalar, Index > & | mesh, |
VertexNormalOptions | options = {} |
||
) |
#include <lagrange/compute_vertex_normal.h>
Compute per-vertex normals based on specified weighting type.
[in] | mesh | The input mesh. |
[in] | options | Optional arguments to control normal generation. |
VertexNormalOptions
. AttributeId compute_vertex_valence | ( | SurfaceMesh< Scalar, Index > & | mesh, |
VertexValenceOptions | options = {} |
||
) |
#include <lagrange/compute_vertex_valence.h>
Compute vertex valence.
mesh | The input mesh. |
options | Optional settings to control valence computation. |
VertexValenceOptions
AdjacencyList< Index > compute_vertex_vertex_adjacency | ( | SurfaceMesh< Scalar, Index > & | mesh | ) |
AttributeId compute_weighted_corner_normal | ( | SurfaceMesh< Scalar, Index > & | mesh, |
CornerNormalOptions | option = {} |
||
) |
#include <lagrange/compute_weighted_corner_normal.h>
Compute corner normals.
[in] | mesh | The input mesh. |
[in] | option | Optional arguments to control normal generation. |
options.weight_type
is not Uniform
, the resulting corner normal's lengths encodes the corresponding weight.CornerNormalOptions
, compute_normal
. SurfaceMesh< Scalar, Index > eigen_to_surface_mesh | ( | const Eigen::MatrixBase< DerivedV > & | V, |
const Eigen::MatrixBase< DerivedF > & | F | ||
) |
#include <lagrange/eigen_convert.h>
Create a SurfaceMesh from a igl-style pair of matrices (V, F).
[in] | V | #V x d matrix of vertex positions. |
[in] | F | #F x k matrix of facet indices. E.g. k=3 for triangle meshes, k=4 for quad meshes. |
Scalar | Target mesh scalar type (required). Either float or double. |
Index | Target mesh index type (required). Either uint32_t or uint64_t. |
DerivedV | Input vertex matrix type. |
DerivedF | Input facet matrix type. |
std::vector< std::vector< Index > > extract_boundary_loops | ( | const SurfaceMesh< Scalar, Index > & | mesh | ) |
#include <lagrange/extract_boundary_loops.h>
Extract boundary loops from a surface mesh.
Scalar | The scalar type of the mesh. |
Index | The index type of the mesh. |
mesh | The input surface mesh. |
SurfaceMesh< Scalar, Index > extract_submesh | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
span< const Index > | selected_facets, | ||
const SubmeshOptions & | options = {} |
||
) |
#include <lagrange/extract_submesh.h>
Extract a submesh that consists of a subset of the facets of the source mesh.
Scalar | The scalar type. |
Index | The index type. |
[in] | mesh | The source mesh. |
[in] | selected_facets | The set of selected facets to extract. |
[in] | options | Extraction options. |
SubmeshOptions
std::vector< AttributeId > filtered_attribute_ids | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
const AttributeFilter & | options | ||
) |
#include <lagrange/filter_attributes.h>
Create a list of attribute ids corresponding to the given filter.
[in] | mesh | Mesh whose attributes are being filtered. |
[in] | options | Filter options. |
SurfaceMesh< Scalar, Index > filter_attributes | ( | SurfaceMesh< Scalar, Index > | source_mesh, |
const AttributeFilter & | options = {} |
||
) |
#include <lagrange/filter_attributes.h>
Filters the attributes of mesh according to user specifications.
[in] | source_mesh | Input mesh. |
[in] | options | Filter options. |
std::optional< AttributeId > find_matching_attribute | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
const AttributeMatcher & | options | ||
) |
std::vector< AttributeId > find_matching_attributes | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
const AttributeMatcher & | options | ||
) |
std::vector< AttributeId > find_matching_attributes | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
AttributeUsage | usage | ||
) |
#include <lagrange/find_matching_attributes.h>
Finds all attributes with the specified usage.
std::vector< AttributeId > find_matching_attributes | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
BitField< AttributeElement > | element_types | ||
) |
#include <lagrange/find_matching_attributes.h>
Finds all attributes with the specified element types.
[in] | mesh | Mesh whose attribute to retrieve. |
[in] | element_types | Element types to match against. |
SurfaceMesh< Scalar, Index > to_surface_mesh_copy | ( | const MeshType & | mesh | ) |
#include <lagrange/mesh_convert.h>
Convert a legacy mesh object to a surface mesh object.
[in] | mesh | Mesh object to convert. |
Scalar | Output mesh scalar type. Must be either float or double. |
Index | Output mesh index type. Must be either uint32_t or uint64_t. |
MeshType | Input mesh type. |
SurfaceMesh< Scalar, Index > to_surface_mesh_wrap | ( | MeshType && | mesh | ) |
#include <lagrange/mesh_convert.h>
Wrap a legacy mesh object as a surface mesh object.
The mesh scalar & index types must match.
[in] | mesh | Mesh object to convert. The mesh object must be a lvalue reference (no temporary). |
Scalar | Output mesh scalar type. Must be either float or double. |
Index | Output mesh index type. Must be either uint32_t or uint64_t. |
MeshType | Input mesh type. |
std::unique_ptr< MeshType > to_legacy_mesh | ( | const SurfaceMesh< Scalar, Index > & | mesh | ) |
#include <lagrange/mesh_convert.h>
Convert a surface mesh object to a legacy mesh object.
The mesh must be a regular mesh object.
[in] | mesh | Mesh object to convert. |
MeshType | Output mesh type. |
Scalar | Input mesh scalar type. Must be either float or double. |
Index | Input mesh index type. Must be either uint32_t or uint64_t. |
void normalize_mesh | ( | SurfaceMesh< Scalar, Index > & | mesh | ) |
void normalize_meshes | ( | span< SurfaceMesh< Scalar, Index > * > | meshes | ) |
bool is_oriented | ( | const SurfaceMesh< Scalar, Index > & | mesh | ) |
#include <lagrange/orientation.h>
Check if a mesh is oriented.
A mesh is oriented if interior edges have the same number of half-edges for each of the edge direction.
mesh | The input mesh. |
Scalar | The scalar type of the mesh. |
Index | The index type of the mesh. |
< initial value of the result.
< initial value of the result.
AttributeId compute_edge_is_oriented | ( | SurfaceMesh< Scalar, Index > & | mesh, |
const OrientationOptions & | options = {} |
||
) |
#include <lagrange/orientation.h>
Compute a mesh attribute indicating whether an edge is oriented.
[in,out] | mesh | Input mesh. |
[in] | options | Output attribute options. |
void permute_facets | ( | SurfaceMesh< Scalar, Index > & | mesh, |
span< const Index > | new_to_old | ||
) |
#include <lagrange/permute_facets.h>
Reorder facets of a mesh based on a given permutation.
i.e. rearrangement facets so that they are ordered as specified by the new_to_old
index array. The total number of facets is unchanged.
[in,out] | mesh | The target mesh whose facets will be reordered in place. |
[in] | new_to_old | The permutation index array specifying the new facet order. This array can often be obtained via index-based sorting of the facets with customized comparison. |
extract_submesh
to extract a subset of the facets. void permute_vertices | ( | SurfaceMesh< Scalar, Index > & | mesh, |
span< const Index > | new_to_old | ||
) |
#include <lagrange/permute_vertices.h>
Reorder vertices of a mesh based on a given permutation.
i.e. rearrangement vertices so that they are ordered as specified by the new_to_old
index array. The total number of vertices is unchanged.
[in,out] | mesh | The target mesh whose vertices will be reordered in place. |
[in] | new_to_old | The permutation index array specifying the new vertex order. This array can often be obtained via index-based sorting of the vertices with customized comparison. |
remap_vertices
if two or more vertices may be combined. void remap_vertices | ( | SurfaceMesh< Scalar, Index > & | mesh, |
span< const Index > | forward_mapping, | ||
RemapVerticesOptions | options = {} |
||
) |
#include <lagrange/remap_vertices.h>
Remap vertices of a mesh based on provided forward mapping.
[in,out] | mesh | The target mesh. |
[in] | forward_mapping | Vertex mapping where vertex i will be remapped to vertex forward_mapping[i] . |
forward_mapping
must be surjective.options
.permute_vertices
for simply permuting the vertex order. RemapVerticesOptions
. bool select_facets_in_frustum | ( | SurfaceMesh< Scalar, Index > & | mesh, |
const Frustum< Scalar > & | frustum, | ||
const FrustumSelectionOptions & | options = {} |
||
) |
#include <lagrange/select_facets_in_frustum.h>
Select all facets that intersect the cone/frustrum bounded by 4 planes defined by (n_i, p_i), where n_i is the plane normal and p_i is a point on the plane.
[in,out] | mesh | The input mesh. |
[in] | frustum | A collection of four planes. |
[in] | options | Optional arguments (greedy, output_attribute_name). |
options.greedy
is true, this function returns as soon as the first facet is selected.options.greedy
is false, the computed selection is stored in mesh
as a facet attribute named options.output_attribute_name
.std::vector< SurfaceMesh< Scalar, Index > > separate_by_components | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
const SeparateByComponentsOptions & | options = {} |
||
) |
#include <lagrange/separate_by_components.h>
Separate a mesh by connected components.
Scalar | The scalar type. |
Index | The index type. |
[in] | mesh | The source mesh. |
[in] | options | Option settings. |
SubmeshOptions
std::vector< SurfaceMesh< Scalar, Index > > separate_by_facet_groups | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
size_t | num_groups, | ||
span< const Index > | facet_group_indices, | ||
const SeparateByFacetGroupsOptions & | options = {} |
||
) |
#include <lagrange/separate_by_facet_groups.h>
Extract a set of submeshes based on facet groups.
Facets with the same group index are grouped together in a single submesh.
Scalar | The scalar type. |
Index | The index type. |
[in] | mesh | The source mesh. |
[in] | num_groups | The number of face groups. |
[in] | facet_group_indices | The group index of each facet. Each group index must be in the range of [0, num_groups - 1]. |
[in] | options | Extraction options. |
std::vector< SurfaceMesh< Scalar, Index > > separate_by_facet_groups | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
span< const Index > | facet_group_indices, | ||
const SeparateByFacetGroupsOptions & | options = {} |
||
) |
#include <lagrange/separate_by_facet_groups.h>
Extract a set of submeshes based on facet groups.
Facets with the same group index are grouped together in a single submesh.
Scalar | The scalar type. |
Index | The index type. |
[in] | mesh | The source mesh. |
[in] | facet_group_indices | The group index of each facet. Each group index must be in the range of [0, max(facet_group_indices)]. |
[in] | options | Extraction options. |
std::vector< SurfaceMesh< Scalar, Index > > separate_by_facet_groups | ( | const SurfaceMesh< Scalar, Index > & | mesh, |
size_t | num_groups, | ||
function_ref< Index(Index)> | get_facet_group, | ||
const SeparateByFacetGroupsOptions & | options = {} |
||
) |
#include <lagrange/separate_by_facet_groups.h>
Extract a set of submeshes based on facet groups.
Facets with the same group index are grouped together in a single submesh.
Scalar | The scalar type. |
Index | The index type. |
[in] | mesh | The source mesh. |
[in] | num_groups | The number of face groups. |
[in] | get_facet_group | Function that returns the facet group id from facet id. The groud id must be in [0, num_groups - 1]. |
[in] | options | Extraction options. |
int compute_euler | ( | const SurfaceMesh< Scalar, Index > & | mesh | ) |
#include <lagrange/topology.h>
Compute Euler characteristic of a mesh.
Scalar | The scalar type of the mesh. |
Index | The index type of the mesh. |
mesh | The input mesh. |
bool is_vertex_manifold | ( | const SurfaceMesh< Scalar, Index > & | mesh | ) |
#include <lagrange/topology.h>
Check if a mesh is vertex-manifold.
A mesh is vertex-manifold if and only if the one-ring neighborhood of each vertex is of disc topology. I.e. The boundary of the 1-ring neighborhood is a simple loop for interior vertices, and a simple chain for boundary vertices.
Scalar | The scalar type of the mesh. |
Index | The index type of the mesh. |
mesh | The input mesh. |
< initial value of the result.
< initial value of the result.
bool is_edge_manifold | ( | const SurfaceMesh< Scalar, Index > & | mesh | ) |
#include <lagrange/topology.h>
Check if a mesh is edge-manifold.
A mesh is edge-manifold if and only if every interior edge is incident to exactly two facets, and every boundary edge is incident to exactly one facet.
Scalar | The scalar type of the mesh. |
Index | The index type of the mesh. |
mesh | The input mesh. |
bool is_manifold | ( | const SurfaceMesh< Scalar, Index > & | mesh | ) |
#include <lagrange/topology.h>
Check if a mesh is both vertex-manifold and edge-manifold.
Scalar | The scalar type of the mesh. |
Index | The index type of the mesh. |
mesh | The input mesh. |
AttributeId compute_vertex_is_manifold | ( | SurfaceMesh< Scalar, Index > & | mesh, |
const VertexManifoldOptions & | options = {} |
||
) |
#include <lagrange/topology.h>
Compute a mesh attribute indicating vertex and edge manifoldness.
[in,out] | mesh | Input mesh. |
[in] | options | Output attribute options. |
void transform_mesh | ( | SurfaceMesh< Scalar, Index > & | mesh, |
const Eigen::Transform< Scalar, Dimension, Eigen::Affine > & | transform, | ||
const TransformOptions & | options = {} |
||
) |
#include <lagrange/transform_mesh.h>
Apply an affine transform \( M \) to a mesh in-place.
All mesh attributes are transformed based on their usage tags:
Bitangent: Applies \( P \to normalize(M * P) \)
[in,out] | mesh | Mesh to transform in-place. |
[in] | transform | Affine transform to apply. |
[in] | options | Transform options. |
SurfaceMesh< Scalar, Index > transformed_mesh | ( | SurfaceMesh< Scalar, Index > | mesh, |
const Eigen::Transform< Scalar, Dimension, Eigen::Affine > & | transform, | ||
const TransformOptions & | options = {} |
||
) |
#include <lagrange/transform_mesh.h>
Apply an affine transform to a mesh and return the transformed mesh.
All mesh attributes are transformed based on their usage tags:
Bitangent: Applies \( P \to normalize(M * P) \)
[in] | mesh | Mesh to transform in-place. |
[in] | transform | Affine transform to apply. |
[in] | options | Transform options. |
Scalar | Mesh scalar type. |
Index | Mesh index type. |
Dimension | Transform dimension (either 2 or 3). Must match mesh dimension. |
void triangulate_polygonal_facets | ( | SurfaceMesh< Scalar, Index > & | mesh | ) |