Lagrange
lagrange Namespace Reference

Main namespace for Lagrange. More...

Namespaces

namespace  image
 Basic image data structure.
 
namespace  internal
 nullptr_t, size_t, ptrdiff_t basic_ostream bad_weak_ptr extent, remove_extent, is_array, is_void, common_type move, forward, swap
 
namespace  io
 Mesh input/output.
 
namespace  partitioning
 Mesh partitioning using METIS.
 
namespace  raycasting
 Raycasting operations.
 
namespace  subdivision
 Subdivision surfaces.
 
namespace  ui
 Lagrange UI Viewer and mini 3D engine.
 

Classes

class  ActingMeshGeometry
 
class  AdjacencyList
 Adjacency list. More...
 
class  Attribute
 Derived attribute class that stores the actual information. More...
 
class  AttributeBase
 Base handle for attributes. 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  AttributeName
 
class  Attributes
 Legacy attribute class. More...
 
struct  BadCastError
 An exception of this type is thrown when a lagrange::safe_cast<> fails. More...
 
class  BitField
 Bit field utility class. More...
 
struct  ChainEdgesOptions
 Options for chain_directed_edges and chain_undirected_edges. More...
 
struct  ChainEdgesResult
 Result struct holding the loops and chains extracted from a set of edges. More...
 
struct  ComponentOptions
 Options to control connected components computation. More...
 
struct  ComputePointcloudPCAOptions
 
class  Connectivity
 
class  copy_on_write_ptr
 A handle type with copy-on-write semantics. More...
 
struct  CornerNormalOptions
 Option struct for computing per-corner mesh normals. More...
 
struct  DihedralAngleOptions
 Option struct for computing dihedral angles. More...
 
struct  DijkstraDistanceOptions
 Option struct for compute_dijkstra_distance. More...
 
class  DisjointSets
 Disjoint sets computation. More...
 
class  DisjointSetsWithSize
 
struct  EdgeLengthOptions
 
class  EdgeType
 
struct  Error
 Base exception for errors thrown by Lagrange functions. More...
 
class  ExactPredicates
 
class  ExactPredicatesShewchuk
 
struct  FacetAreaOptions
 Option struct for computing per-facet area. More...
 
struct  FacetCentroidOptions
 Option struct for computing per-facet centroid. More...
 
struct  FacetNormalOptions
 Option struct for computing per-facet mesh normals. More...
 
struct  Frustum
 An array of four planes that define a frustum. More...
 
struct  FrustumSelectionOptions
 Option struct for selecting facets. More...
 
class  function_ref
 A lightweight non-owning reference to a callable. More...
 
class  function_ref< R(Args...)>
 Specialization for function types. More...
 
class  GenuineMeshGeometry
 
struct  GreedyColoringOptions
 Option struct for computing dihedral angles. More...
 
class  IndexedAttribute
 Derived attribute class that stores the actual information. More...
 
class  IndexedAttributes
 Legacy indexed attribute class. More...
 
struct  IsolineOptions
 Options for isoline extraction/trimming. More...
 
class  Mesh
 
struct  MeshAreaOptions
 Option struct for computing mesh area. More...
 
class  MeshBase
 
struct  MeshCentroidOptions
 Option struct for computing mesh centroid. More...
 
struct  MeshCovarianceOptions
 Options struct for computing mesh covariance. More...
 
class  MeshGeometry
 
class  MeshNavigation
 This class is used to navigate elements of a mesh. More...
 
struct  MeshTrait
 MeshTrait class provide compiler check for different mesh types. More...
 
struct  NormalOptions
 Option struct for computing indexed mesh normals. More...
 
struct  OrderedPairHash
 Compute an order-dependent hash of a pair of values. More...
 
struct  OrderedPairHash< std::pair< U, V > >
 
struct  OrientationOptions
 Option struct for computing if edges are oriented. More...
 
struct  OrientOptions
 Options for orienting the facets of a mesh. More...
 
struct  ParsingError
 An exception of this type is thrown when a parsing error occurs. More...
 
struct  PointcloudPCAOutput
 
class  ProgressCallback
 A simple thread-safe progress callback. More...
 
struct  RemapVerticesOptions
 Remap vertices options. More...
 
struct  RemoveDuplicateFacetOptions
 Options for remove_duplicate_facets. More...
 
struct  RemoveDuplicateVerticesOptions
 Option struct for remove_duplicate_vertices. More...
 
struct  RemoveNullAreaFacetsOptions
 Option struct for remove_null_area_facets. More...
 
struct  SamplePointsOnSurfaceOutput
 
class  ScopedLogLevel
 Changes the level of logger to something else in a scope. More...
 
class  ScopedTimer
 Similar to a VerboseTimer, but uses RAII to call tick()/tock(). More...
 
struct  SeamEdgesOptions
 Options for computing seam edges. More...
 
struct  SelectFacetsByNormalSimilarityOptions
 Option struct for selecting facets based on normal similarity. More...
 
struct  SeparateByComponentsOptions
 Option settings for separate_by_components. More...
 
struct  SeparateByFacetGroupsOptions
 Option settings for separate_by_facet_groups. More...
 
class  SharedSpan
 Shared span with ownership tracking. More...
 
class  SilentMultiTimer
 A timer that keeps track of a total time as well as intervals. More...
 
class  SilentTimer
 A timer that does not print after tock() More...
 
class  SmallVector
 Hybrid vector that uses the stack upto a maximum size, and the heap beyond that. More...
 
struct  SplitLongEdgesOptions
 
struct  StackSet
 Stack-allocated set with a maximum size. More...
 
struct  StackVector
 Stack-allocated vector with a maximum size. More...
 
struct  StaticAssertableBool
 Compilers might complain about static_assert(false, ""). More...
 
struct  SubmeshOptions
 Options for extract submesh. More...
 
class  SurfaceMesh
 A general purpose polygonal mesh class. More...
 
struct  TangentBitangentOptions
 Option struct for computing tangent and bitangent vectors. More...
 
struct  TangentBitangentResult
 Result type of the compute_tangent_bitangent function. More...
 
struct  ThickenAndCloseOptions
 Options for thicken_and_close_mesh. More...
 
struct  TransformOptions
 Options available when applying affine transforms to a mesh. More...
 
struct  UVDistortionOptions
 Option struct for compute uv distortion. More...
 
class  value_ptr
 Smart pointer with value semantics. More...
 
class  VerboseTimer
 Creates a verbose timer that prints after tock(). More...
 
struct  VertexManifoldOptions
 Option struct for computing manifold flags. More...
 
struct  VertexNormalOptions
 Option struct for computing per-vertex mesh normals. More...
 
struct  VertexValenceOptions
 Option struct for computing vertex valence. More...
 
struct  WeldOptions
 Options for welding indexed attributes. More...
 

Typedefs

using AttributeId = uint32_t
 Identified to be used to access an attribute. More...
 
using Vertices2D = Eigen::Matrix< double, Eigen::Dynamic, 2, Eigen::RowMajor >
 
using Vertices3D = Eigen::Matrix< double, Eigen::Dynamic, 3, Eigen::RowMajor >
 
using Vertices2Df = Eigen::Matrix< float, Eigen::Dynamic, 2, Eigen::RowMajor >
 
using Vertices3Df = Eigen::Matrix< float, Eigen::Dynamic, 3, Eigen::RowMajor >
 
using Triangles = Eigen::Matrix< int, Eigen::Dynamic, 3, Eigen::RowMajor >
 
using Quads = Eigen::Matrix< int, Eigen::Dynamic, 4, Eigen::RowMajor >
 
using TriangleMesh3D = Mesh< Vertices3D, Triangles >
 
using TriangleMesh2D = Mesh< Vertices2D, Triangles >
 
using TriangleMesh3Df = Mesh< Vertices3Df, Triangles >
 
using TriangleMesh2Df = Mesh< Vertices2Df, Triangles >
 
using QuadMesh3D = Mesh< Vertices3D, Quads >
 
using QuadMesh2D = Mesh< Vertices2D, Quads >
 
using QuadMesh3Df = Mesh< Vertices3Df, Quads >
 
using QuadMesh2Df = Mesh< Vertices2Df, Quads >
 
template<class T >
using ScalarOf = typename T::Scalar
 
template<class T >
using IndexOf = typename T::Index
 
template<class T >
using VertexArrayOf = typename T::VertexArray
 
template<class T >
using FacetArrayOf = typename T::FacetArray
 
template<class T >
using AttributeArrayOf = typename T::AttributeArray
 
template<typename Index , typename T >
using EdgeMap = std::unordered_map< EdgeType< Index >, T >
 
template<typename Index >
using EdgeSet = std::unordered_set< EdgeType< Index > >
 
template<typename MeshType >
using EdgeFacetMap = std::unordered_map< EdgeType< typename MeshType::Index >, std::vector< typename MeshType::Index > >
 
using SurfaceMesh32f = SurfaceMesh< float, uint32_t >
 
using SurfaceMesh32d = SurfaceMesh< double, uint32_t >
 
using SurfaceMesh64f = SurfaceMesh< float, uint64_t >
 
using SurfaceMesh64d = SurfaceMesh< double, uint64_t >
 
template<class T , span_CONFIG_EXTENT_TYPE Extent = ::nonstd::dynamic_extent>
using span = ::nonstd::span< T, Extent >
 A bounds-safe view for sequences of objects. More...
 
using extent_t = span_CONFIG_EXTENT_TYPE
 Span extent type.
 
using timestamp_type = std::chrono::time_point< std::chrono::steady_clock >
 
Typedefs
template<typename Scalar >
using RowMatrix = Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >
 Type alias for row-major Eigen matrices.
 
template<typename Scalar >
using RowMatrixView = Eigen::Map< RowMatrix< Scalar >, Eigen::Unaligned >
 Type alias for row-major matrix views.
 
template<typename Scalar >
using ConstRowMatrixView = const Eigen::Map< const RowMatrix< Scalar >, Eigen::Unaligned >
 Type alias for row-major const matrix view.
 
template<typename Scalar >
using Vector = Eigen::Matrix< Scalar, Eigen::Dynamic, 1 >
 Type alias for one-dimensional column Eigen vectors.
 
template<typename Scalar >
using VectorView = Eigen::Map< Vector< Scalar >, Eigen::Unaligned >
 Type alias for row-major vector view.
 
template<typename Scalar >
using ConstVectorView = const Eigen::Map< const Vector< Scalar >, Eigen::Unaligned >
 Type alias for row-major const vector view.
 

Enumerations

enum  AttributeElement : int {
  Vertex = (1 << 0) , Facet = (1 << 1) , Edge = (1 << 2) , Corner = (1 << 3) ,
  Value = (1 << 4) , Indexed = (1 << 5)
}
 Type of element to which the attribute is attached. More...
 
enum class  AttributeUsage : uint16_t {
  Vector = (1 << 0) , Scalar = (1 << 1) , Position = (1 << 2) , Normal = (1 << 3) ,
  Tangent = (1 << 4) , Bitangent = (1 << 5) , Color = (1 << 6) , UV = (1 << 7) ,
  VertexIndex = (1 << 8) , FacetIndex = (1 << 9) , CornerIndex = (1 << 10) , EdgeIndex = (1 << 11) ,
  String = (1 << 12)
}
 Usage tag indicating how the attribute should behave under mesh transformations. More...
 
enum class  AttributeCreatePolicy { ErrorIfReserved , Force }
 Policy for attribute creation with reserved attribute names. More...
 
enum class  AttributeGrowthPolicy { ErrorIfExternal , AllowWithinCapacity , WarnAndCopy , SilentCopy }
 Policy for growing external attribute buffers. More...
 
enum class  AttributeShrinkPolicy { ErrorIfExternal , IgnoreIfExternal , WarnAndCopy , SilentCopy }
 Policy for shrinking external attribute buffers. More...
 
enum class  AttributeWritePolicy { ErrorIfReadOnly , WarnAndCopy , SilentCopy }
 Policy for attempting to write to read-only external buffers. More...
 
enum class  AttributeExportPolicy { CopyIfExternal , CopyIfUnmanaged , KeepExternalPtr , ErrorIfExternal }
 Policy for exporting attributes that are views onto external buffers. More...
 
enum class  AttributeCopyPolicy { CopyIfExternal , KeepExternalPtr , ErrorIfExternal }
 Policy for copying attribute that are views onto external buffers. More...
 
enum class  AttributeDeletePolicy { ErrorIfReserved , Force }
 Policy for attribute deletion of reserved attribute names. More...
 
enum class  AttributeValueType : uint8_t { LA_X_attribute_value_type_enum }
 Enum describing at runtime the value type of an attribute. More...
 
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...
 
enum class  ReorderingMethod { Lexicographic , Morton , Hilbert , None }
 Mesh reordering method to apply before decimation. More...
 
enum class  ConnectivityType { Vertex , Edge }
 This type defines the condition when two facets are considered as "connected". More...
 
enum class  MappingPolicy { Average , KeepFirst , Error }
 Mapping policy control the behavior when two or more elements are mapped into the same output element. More...
 
enum class  Orientation : short { Positive = 1 , Zero = 0 , Negative = -1 }
 

Functions

constexpr AttributeId invalid_attribute_id ()
 Invalid attribute id.
 
template<typename AttributeArray , typename Archive >
void serialize (Attributes< AttributeArray > &attributes, Archive &ar)
 
template<typename ValueType >
constexpr AttributeValueType make_attribute_value_type ()
 Creates an enum describing an attribute value type. More...
 
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 DerivedF , typename DerivedC , typename DerivedE , typename DerivedN >
void chain_corners_around_edges (const Eigen::MatrixBase< DerivedF > &facets, const Eigen::MatrixBase< DerivedC > &corner_to_edge, Eigen::PlainObjectBase< DerivedE > &edge_to_corner, Eigen::PlainObjectBase< DerivedN > &next_corner_around_edge)
 Chains facet corners around edges of a mesh. More...
 
template<typename DerivedF , typename DerivedE , typename DerivedN >
void chain_corners_around_vertices (typename DerivedF::Scalar num_vertices, const Eigen::MatrixBase< DerivedF > &facets, Eigen::PlainObjectBase< DerivedE > &vertex_to_corner, Eigen::PlainObjectBase< DerivedN > &next_corner_around_vertex)
 Chains facet corners around vertices of a mesh. 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 Derived1 , typename Derived2 >
void move_data (Eigen::DenseBase< Derived1 > &from, Eigen::DenseBase< Derived2 > &to)
 Move data from one Eigen obj to another. More...
 
template<class T >
std::shared_ptr< T > to_shared_ptr (std::unique_ptr< T > &&ptr)
 Helper for automatic type deduction for unique_ptr to shared_ptr conversion.
 
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 PointType >
auto compute_barycentric_coordinates (const Eigen::MatrixBase< PointType > &v0, const Eigen::MatrixBase< PointType > &v1, const Eigen::MatrixBase< PointType > &v2, const Eigen::MatrixBase< PointType > &p) -> Eigen::Matrix< typename PointType::Scalar, 3, 1 >
 
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 MeshType , typename Cloud , typename Indices >
auto compute_lift_operator_from_sampling (const MeshType &mesh, const Cloud &closest_points, const Indices &element_indices)
 This compute the sparse bilinear map from mesh vertex attributes to point cloud attributes. More...
 
template<typename MeshType , typename ClosestPoints >
auto compute_lift_operator_from_projections (const MeshType &mesh, const ClosestPoints &projections)
 This compute the sparse bilinear map from mesh vertex attributes to point cloud attributes. More...
 
template<typename Scalar , typename Index >
std::array< std::array< Scalar, 3 >, 3 > compute_mesh_covariance (const SurfaceMesh< Scalar, Index > &mesh, const MeshCovarianceOptions &options={})
 Compute the covariance matrix w.r.t. 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 >
PointcloudPCAOutput< Scalar > compute_pointcloud_pca (span< const Scalar > points, ComputePointcloudPCAOptions options={})
 Finds the principal components for a pointcloud. More...
 
template<typename Scalar , typename Index >
AttributeId compute_seam_edges (SurfaceMesh< Scalar, Index > &mesh, AttributeId indexed_attribute_id, const SeamEdgesOptions &options={})
 Computes the seam edges for a given indexed attribute. 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 GeometryType >
std::unique_ptr< Connectivity< GeometryType > > compute_connectivity (const GeometryType &geometry)
 
template<typename DerivedF , typename DerivedC >
Eigen::Index corner_to_edge_mapping (const Eigen::MatrixBase< DerivedF > &F, Eigen::PlainObjectBase< DerivedC > &C2E)
 Computes a mapping from mesh corners (k*f+i) to unique edge ids. More...
 
template<typename DerivedV , typename DerivedF >
std::unique_ptr< Mesh< DerivedV, DerivedF > > create_empty_mesh ()
 
template<typename DerivedV , typename DerivedF >
auto create_mesh (const Eigen::MatrixBase< DerivedV > &vertices, const Eigen::MatrixBase< DerivedF > &facets)
 This function create a new mesh given the vertex and facet arrays by copying data into the Mesh object. More...
 
template<typename DerivedV , typename DerivedF >
std::unique_ptr< Mesh< DerivedV, DerivedF > > create_mesh (Eigen::PlainObjectBase< DerivedV > &&vertices, Eigen::PlainObjectBase< DerivedF > &&facets)
 This function create a new mesh given the vertex and facet arrays by moving data into the Mesh object. More...
 
template<typename DerivedV , typename DerivedF >
std::unique_ptr< Mesh< DerivedV, DerivedF > > create_mesh (const Eigen::MatrixBase< DerivedV > &vertices, Eigen::MatrixBase< DerivedF > &&facets)
 
template<typename DerivedV , typename DerivedF >
std::unique_ptr< Mesh< DerivedV, DerivedF > > create_mesh (Eigen::MatrixBase< DerivedV > &&vertices, const Eigen::MatrixBase< DerivedF > &facets)
 
template<typename VertexArray , typename FacetArray >
auto wrap_with_mesh (const Eigen::MatrixBase< VertexArray > &vertices, const Eigen::MatrixBase< FacetArray > &facets)
 This method creates a Mesh object that wraps around vertices and facets. More...
 
template<typename VertexArray , typename FacetArray >
void wrap_with_mesh (const Eigen::MatrixBase< VertexArray > &&, const Eigen::MatrixBase< FacetArray > &&)
 
template<typename VertexArray , typename FacetArray >
void wrap_with_mesh (const Eigen::MatrixBase< VertexArray > &, const Eigen::MatrixBase< FacetArray > &&)
 
template<typename VertexArray , typename FacetArray >
void wrap_with_mesh (const Eigen::MatrixBase< VertexArray > &&, const Eigen::MatrixBase< FacetArray > &)
 
std::unique_ptr< TriangleMesh3D > LA_CORE_API create_cube ()
 
std::unique_ptr< TriangleMesh3D > LA_CORE_API create_quad (bool with_center_vertex)
 
std::unique_ptr< TriangleMesh3D > LA_CORE_API create_sphere (double refine_order=2)
 
template<typename MeshType >
EdgeFacetMap< MeshTypecompute_edge_facet_map_in_active_facets (const MeshType &mesh, const std::unordered_set< typename MeshType::Index > &active_facets)
 
template<typename MeshType >
EdgeFacetMap< MeshTypecompute_edge_facet_map_in_active_vertices (const MeshType &mesh, const std::unordered_set< typename MeshType::Index > &active_vertices)
 
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< AttributeIdfiltered_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< AttributeIdfind_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< AttributeIdfind_matching_attribute (const SurfaceMesh< Scalar, Index > &mesh, AttributeUsage usage)
 
template<typename Scalar , typename Index >
std::optional< AttributeIdfind_matching_attribute (const SurfaceMesh< Scalar, Index > &mesh, BitField< AttributeElement > element_types)
 
template<typename Scalar , typename Index >
std::vector< AttributeIdfind_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< AttributeIdfind_matching_attributes (const SurfaceMesh< Scalar, Index > &mesh, AttributeUsage usage)
 Finds all attributes with the specified usage. More...
 
template<typename Scalar , typename Index >
std::vector< AttributeIdfind_matching_attributes (const SurfaceMesh< Scalar, Index > &mesh, BitField< AttributeElement > element_types)
 Finds all attributes with the specified element types. More...
 
template<typename _VertexArray , typename _FacetArray , typename Archive >
void serialize (std::shared_ptr< MeshGeometry< _VertexArray, _FacetArray > > &geometry, Archive &ar)
 
template<typename DerivedF >
EdgeType< typename DerivedF::Scalar > get_opposite_edge (const Eigen::PlainObjectBase< DerivedF > &facets, typename DerivedF::Scalar fid, typename DerivedF::Scalar vid)
 
template<typename Scalar , typename Index >
SurfaceMesh< Scalar, Index > trim_by_isoline (const SurfaceMesh< Scalar, Index > &mesh, const IsolineOptions &options={})
 Trim a mesh by the isoline of an implicit function defined on the mesh vertices/corners. More...
 
template<typename Scalar , typename Index >
SurfaceMesh< Scalar, Index > extract_isoline (const SurfaceMesh< Scalar, Index > &mesh, const IsolineOptions &options={})
 Extract the isoline of an implicit function defined on the mesh vertices/corners. More...
 
LA_CORE_API spdlog::logger & logger ()
 Retrieves the current logger. More...
 
LA_CORE_API void set_logger (std::shared_ptr< spdlog::logger > logger)
 Setup a logger object to be used by Lagrange. More...
 
template<typename _VertexArray , typename _FacetArray , typename Archive >
void serialize (Mesh< _VertexArray, _FacetArray > &mesh, Archive &ar)
 
template<typename MeshType >
std::unique_ptr< MeshTypeclose_small_holes (MeshType &mesh, size_t max_hole_size)
 Close small topological holes. More...
 
template<typename Scalar , typename Index >
std::vector< Index > detect_degenerate_facets (const SurfaceMesh< Scalar, Index > &mesh)
 Detects degenerate facets in a mesh. More...
 
template<typename Scalar , typename Index >
void remove_degenerate_facets (SurfaceMesh< Scalar, Index > &mesh)
 Removes degenerate facets from a mesh. More...
 
template<typename Scalar , typename Index >
void remove_duplicate_facets (SurfaceMesh< Scalar, Index > &mesh, const RemoveDuplicateFacetOptions &opts={})
 Remove duplicate facets in the mesh. More...
 
template<typename Scalar , typename Index >
void remove_duplicate_vertices (SurfaceMesh< Scalar, Index > &mesh, const RemoveDuplicateVerticesOptions &options={})
 Removes duplicate vertices from a mesh. More...
 
template<typename Scalar , typename Index >
void remove_isolated_vertices (SurfaceMesh< Scalar, Index > &mesh)
 Removes isolated vertices of a mesh. More...
 
template<typename Scalar , typename Index >
void remove_null_area_facets (SurfaceMesh< Scalar, Index > &mesh, const RemoveNullAreaFacetsOptions &options={})
 Removes all facets with unsigned area <= options.null_area_threshold. More...
 
template<typename Scalar , typename Index >
void remove_short_edges (SurfaceMesh< Scalar, Index > &mesh, Scalar threshold=0)
 Collapse all edges shorter than a given tolerance. More...
 
template<typename Scalar , typename Index >
void remove_topologically_degenerate_facets (SurfaceMesh< Scalar, Index > &mesh)
 Remove topologically degenerate facets (i.e. More...
 
template<typename Scalar , typename Index >
void resolve_nonmanifoldness (SurfaceMesh< Scalar, Index > &mesh)
 Resolve both non-manifold vertices and non-manifold edges in the input mesh. More...
 
template<typename Scalar , typename Index >
void resolve_vertex_nonmanifoldness (SurfaceMesh< Scalar, Index > &mesh)
 Resolve nonmanifold vertices by pulling disconnected 1-ring neighborhood apart. More...
 
template<typename Scalar , typename Index >
void split_long_edges (SurfaceMesh< Scalar, Index > &mesh, SplitLongEdgesOptions options={})
 Split edges that are longer than options.max_edge_length. 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< MeshTypeto_legacy_mesh (const SurfaceMesh< Scalar, Index > &mesh)
 Convert a surface mesh object to a legacy mesh object. More...
 
template<typename _VertexArray , typename _FacetArray , typename Archive >
void serialize (MeshGeometry< _VertexArray, _FacetArray > &geometry, Archive &ar)
 
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 >
void orient_outward (lagrange::SurfaceMesh< Scalar, Index > &mesh, const OrientOptions &options={})
 Orient the facets of a mesh so that the signed volume of each connected component is positive or negative. 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 >
void reorder_mesh (SurfaceMesh< Scalar, Index > &mesh, ReorderingMethod method)
 Mesh reordering to improve cache locality. More...
 
template<typename MeshType >
SamplePointsOnSurfaceOutput< MeshTypesample_points_on_surface (MeshType &mesh, const typename MeshType::Index approx_num_points, const typename MeshType::IndexList &active_facets)
 
template<typename MeshType >
SamplePointsOnSurfaceOutput< MeshTypesample_points_on_surface (MeshType &mesh, const typename MeshType::Index approx_num_points, const std::vector< bool > &is_facet_active)
 
template<typename MeshType >
SamplePointsOnSurfaceOutput< MeshTypesample_points_on_surface (MeshType &mesh, const typename MeshType::Index approx_num_points)
 
template<typename PointType >
auto segment_segment_squared_distance (const Eigen::MatrixBase< PointType > &U0, const Eigen::MatrixBase< PointType > &U1, const Eigen::MatrixBase< PointType > &V0, const Eigen::MatrixBase< PointType > &V1, Eigen::PlainObjectBase< PointType > &closest_pointU, Eigen::PlainObjectBase< PointType > &closest_pointV, ScalarOf< PointType > &lambdaU, ScalarOf< PointType > &lambdaV) -> ScalarOf< PointType >
 Computes the squared distance between two N-d line segments, and the closest pair of points whose separation is this distance. More...
 
template<typename Scalar , typename Index >
AttributeId select_facets_by_normal_similarity (SurfaceMesh< Scalar, Index > &mesh, const Index seed_facet_id, const SelectFacetsByNormalSimilarityOptions &options={})
 Given a seed facet, selects facets around it based on the change in triangle normals. 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 >
SurfaceMesh< Scalar, Index > thicken_and_close_mesh (SurfaceMesh< Scalar, Index > input_mesh, const ThickenAndCloseOptions &options={})
 Thicken a mesh by offsetting it, and close the shape into a thick 3D solid. 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...
 
LA_CORE_API void set_breakpoint_enabled (bool enabled)
 Sets whether to trigger a debugger breakpoint on assert failure. More...
 
LA_CORE_API bool is_breakpoint_enabled ()
 Returns whether to trigger a debugger breakpoint on assert failure. More...
 
LA_CORE_API void trigger_breakpoint ()
 Call to explicitly trigger a debugger breakpoint.
 
LA_CORE_API bool assertion_failed (const char *function, const char *file, unsigned int line, const char *condition, std::string_view message)
 Called in case of an assertion failure. More...
 
template<typename Index >
ChainEdgesResult< Index > chain_directed_edges (const span< const Index > edges, const ChainEdgesOptions &options={})
 Chain a set of directed edges into loops and chains. More...
 
template<typename Index >
ChainEdgesResult< Index > chain_undirected_edges (const span< const Index > edges, const ChainEdgesOptions &options={})
 Chain a set of undirected edges into loops and chains. More...
 
LA_CORE_API void enable_fpe ()
 Enable floating-point exceptions (useful for debugging). More...
 
LA_CORE_API void disable_fpe ()
 Disable previously-enabled fpe. More...
 
template<typename R , typename... Args>
constexpr void swap (function_ref< R(Args...)> &lhs, function_ref< R(Args...)> &rhs) noexcept
 Swaps the referred callables of lhs and rhs.
 
template<typename R , typename... Args>
 function_ref (R(*)(Args...)) -> function_ref< R(Args...)>
 Deduce function_ref type from a function pointer.
 
template<typename Scalar >
Scalar sqr_minimum_distance (const Eigen::Vector2< Scalar > &a, const Eigen::Vector2< Scalar > &b, const Eigen::Vector2< Scalar > &p)
 Returns the squared minimum distance between 2d line segment ab and point p.
 
template<typename Scalar >
Eigen::Vector2< Scalar > triangle_circumcenter (const Eigen::Vector2< Scalar > &p1, const Eigen::Vector2< Scalar > &p2, const Eigen::Vector2< Scalar > &p3)
 
template<typename Scalar , int _Rows, int _Cols>
Scalar cos_angle_between (const Eigen::Matrix< Scalar, _Rows, _Cols > &v1, const Eigen::Matrix< Scalar, _Rows, _Cols > &v2)
 Returns the cosine of the angle between two 3d vectors. More...
 
template<typename Scalar , int _Rows, int _Cols>
Scalar angle_between (const Eigen::Matrix< Scalar, _Rows, _Cols > &v1, const Eigen::Matrix< Scalar, _Rows, _Cols > &v2)
 Returns the angle between two 3d vectors.
 
template<typename Scalar , int _Rows, int _Cols>
Eigen::Matrix< Scalar, _Rows, _Cols > project_on_line (const Eigen::Matrix< Scalar, _Rows, _Cols > &v1, const Eigen::Matrix< Scalar, _Rows, _Cols > &v2)
 Project the vector v1 on the line defined by its vector v2. More...
 
template<typename Scalar , int _Rows, int _Cols>
Eigen::Matrix< Scalar, _Rows, _Cols > project_on_plane (const Eigen::Matrix< Scalar, _Rows, _Cols > &v, const Eigen::Matrix< Scalar, _Rows, _Cols > &n)
 Project the vector on the plane defined by its normal n. More...
 
template<typename Scalar , int _Rows, int _Cols>
Scalar projected_cos_angle_between (const Eigen::Matrix< Scalar, _Rows, _Cols > &v1, const Eigen::Matrix< Scalar, _Rows, _Cols > &v2, const Eigen::Matrix< Scalar, _Rows, _Cols > &n)
 Returns the angle between the vectors v1 and v2 projected on the plane defined by its normal n. More...
 
template<typename Scalar , int _Rows, int _Cols>
Scalar projected_angle_between (const Eigen::Matrix< Scalar, _Rows, _Cols > &v1, const Eigen::Matrix< Scalar, _Rows, _Cols > &v2, const Eigen::Matrix< Scalar, _Rows, _Cols > &n)
 Returns the angle between the vectors v1 and v2 projected on the plane defined by its normal n. More...
 
template<typename MeshType >
auto vector_between (const MeshType &mesh, typename MeshType::Index v1, typename MeshType::Index v2)
 Returns the vector from v1 to v2. More...
 
template<typename Scalar >
void orthogonal_frame (const Eigen::Matrix< Scalar, 3, 1 > &x, Eigen::Matrix< Scalar, 3, 1 > &y, Eigen::Matrix< Scalar, 3, 1 > &z)
 Build an orthogonal frame given a single vector. More...
 
template<class T >
void hash_combine (size_t &seed, const T &v)
 Hash an object v and combine it with an existing hash value seed. More...
 
template<typename T >
constexpr T invalid ()
 You can use invalid<T>() to get a value that can represent "invalid" values, such as invalid indices or invalid float data. More...
 
template<typename PointType >
bool point_on_segment (const Eigen::MatrixBase< PointType > &p, const Eigen::MatrixBase< PointType > &a, const Eigen::MatrixBase< PointType > &b)
 Test if a point lies exactly on a segment [a,b] using exact predicates. More...
 
template<typename PointType >
auto point_segment_squared_distance (const Eigen::MatrixBase< PointType > &point, const Eigen::MatrixBase< PointType > &V0, const Eigen::MatrixBase< PointType > &V1, Eigen::PlainObjectBase< PointType > &closest_point, ScalarOf< PointType > &lambda0, ScalarOf< PointType > &lambda1) -> ScalarOf< PointType >
 Computes the point closest to a given point in a nd segment. More...
 
template<typename PointType >
auto point_segment_squared_distance (const Eigen::MatrixBase< PointType > &point, const Eigen::MatrixBase< PointType > &V0, const Eigen::MatrixBase< PointType > &V1) -> ScalarOf< PointType >
 Computes the point closest to a given point in a nd segment. More...
 
template<typename PointType >
auto point_triangle_squared_distance (const Eigen::MatrixBase< PointType > &point, const Eigen::MatrixBase< PointType > &V0, const Eigen::MatrixBase< PointType > &V1, const Eigen::MatrixBase< PointType > &V2, Eigen::PlainObjectBase< PointType > &closest_point, ScalarOf< PointType > &lambda0, ScalarOf< PointType > &lambda1, ScalarOf< PointType > &lambda2) -> ScalarOf< PointType >
 Computes the point closest to a given point in a nd triangle. More...
 
template<typename PointType >
auto point_triangle_squared_distance (const Eigen::MatrixBase< PointType > &point, const Eigen::MatrixBase< PointType > &V0, const Eigen::MatrixBase< PointType > &V1, const Eigen::MatrixBase< PointType > &V2) -> ScalarOf< PointType >
 Computes the squared distance between a point and a nd triangle. More...
 
template<typename Scalar >
Scalar quad_area_2d (span< const Scalar, 2 > a, span< const Scalar, 2 > b, span< const Scalar, 2 > c, span< const Scalar, 2 > d)
 Compute 2D quad signed area. More...
 
template<typename Scalar >
Scalar quad_area_3d (span< const Scalar, 3 > a, span< const Scalar, 3 > b, span< const Scalar, 3 > c, span< const Scalar, 3 > d)
 Compute 3D quad area. More...
 
template<typename Index >
internal::Range< Index > range (Index end)
 Returns an iterable object representing the range [0, end). More...
 
template<typename Index >
internal::Range< Index > range (Index begin, Index end)
 Returns an iterable object representing the range [begin, end). More...
 
template<typename Index >
internal::SparseRange< Index > range_sparse (Index max, const std::vector< Index > &active)
 Returns an iterable object representing a subset of the range [0, max). More...
 
template<typename TargetType , typename SourceType >
constexpr auto safe_cast (SourceType value) -> std::enable_if_t<!std::is_same< SourceType, TargetType >::value, TargetType >
 Perform safe cast from SourceType to TargetType, where "safe" means: More...
 
template<typename T >
constexpr T safe_cast (T value)
 Safe cast specialization for TargetType == SourceType. More...
 
template<typename TargetType >
constexpr TargetType safe_cast (bool value)
 Safe cast specialization for bool. More...
 
template<typename T , typename U >
constexpr T safe_cast_enum (const U u)
 Casting an enum to scalar and vice versa. More...
 
template<typename Callback >
sg_detail::scope_guard< Callback > make_scope_guard (Callback &&callback) noexcept(std::is_nothrow_constructible< Callback, Callback && >::value)
 Creates a scope guard around a callable object. More...
 
template<typename T , typename Y >
SharedSpan< T > make_shared_span (const std::shared_ptr< Y > &r, T *element_ptr, size_t size)
 Created a SharedSpan object around an internal buffer of a parent object. More...
 
template<class T , size_t N>
bool operator== (const StackSet< T, N > &lhs, const StackSet< T, N > &rhs)
 
template<class T , size_t N>
bool operator== (const StackVector< T, N > &lhs, const StackVector< T, N > &rhs)
 
template<typename Scalar , size_t N, typename Derived >
void vector_to_eigen (const std::vector< std::array< Scalar, N > > &from, Eigen::PlainObjectBase< Derived > &to)
 
template<typename Scalar , typename Derived >
void vector_to_eigen (const std::vector< std::pair< Scalar, Scalar > > &from, Eigen::PlainObjectBase< Derived > &to)
 
template<typename Scalar , int N, typename Derived >
void vector_to_eigen (const std::vector< Eigen::Matrix< Scalar, N, 1 > > &from, Eigen::PlainObjectBase< Derived > &to)
 
template<typename Scalar , int N, typename Derived >
void vector_to_eigen (const std::vector< Eigen::Matrix< Scalar, 1, N > > &from, Eigen::PlainObjectBase< Derived > &to)
 
template<typename Scalar >
void vector_to_eigen (const std::vector< Scalar > &from, Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &to)
 
template<typename Scalar , typename Derived >
void flat_vector_to_eigen (const std::vector< Scalar > &from, Eigen::PlainObjectBase< Derived > &to, size_t rows, size_t cols, int row_major_flag=Eigen::RowMajor)
 
template<typename Derived , typename Scalar , size_t N>
void eigen_to_vector (const Eigen::MatrixBase< Derived > &from, std::vector< std::array< Scalar, N > > &to)
 
template<typename Derived , typename Scalar >
void eigen_to_vector (const Eigen::MatrixBase< Derived > &from, std::vector< std::pair< Scalar, Scalar > > &to)
 
template<typename Derived , typename Scalar >
void eigen_to_flat_vector (const Eigen::MatrixBase< Derived > &from, std::vector< Scalar > &to, int row_major_flag=Eigen::RowMajor)
 
LA_CORE_API std::vector< std::string > string_split (const std::string &str, char delimiter)
 Split a std::string using a prescribed delimiter. More...
 
LA_CORE_API bool starts_with (std::string_view str, std::string_view prefix)
 Checks if the string begins with the given prefix. More...
 
LA_CORE_API bool ends_with (std::string_view str, std::string_view suffix)
 Checks if the string ends with the given suffix. More...
 
LA_CORE_API std::string to_lower (std::string str)
 Convert a string to lowercase. More...
 
LA_CORE_API std::string to_upper (std::string str)
 Convert a string to uppercase. More...
 
template<typename... Args>
std::string string_format (fmt::format_string< Args... > format, Args &&... args)
 Format args according to the format string fmt, and return the result as a string. More...
 
void get_timestamp (timestamp_type *t)
 
timestamp_type get_timestamp ()
 
double timestamp_diff_in_seconds (timestamp_type start, timestamp_type end)
 
double timestamp_diff_in_seconds (timestamp_type start)
 
template<typename Scalar >
Scalar triangle_area_3d (span< const Scalar, 3 > a, span< const Scalar, 3 > b, span< const Scalar, 3 > c)
 Compute 3D triangle area. More...
 
template<typename Scalar >
Scalar triangle_area_2d (span< const Scalar, 2 > a, span< const Scalar, 2 > b, span< const Scalar, 2 > c)
 Compute 2D triangle signed area. More...
 
enum lagrange::Orientation short triangle_orientation (span< const Scalar, 2 > a, span< const Scalar, 2 > b, span< const Scalar, 2 > c)
 Compute orientation of a 2D triangle. More...
 
template<DistortionMetric metric, typename Scalar >
Scalar triangle_uv_distortion (span< const Scalar, 3 > V0, span< const Scalar, 3 > V1, span< const Scalar, 3 > V2, span< const Scalar, 2 > v0, span< const Scalar, 2 > v1, span< const Scalar, 2 > v2)
 Compute uv distortion of a single triangle. More...
 
template<typename Scalar >
Scalar triangle_uv_distortion (span< const Scalar, 3 > V0, span< const Scalar, 3 > V1, span< const Scalar, 3 > V2, span< const Scalar, 2 > v0, span< const Scalar, 2 > v1, span< const Scalar, 2 > v2, DistortionMetric metric)
 Compute uv distortion of a single triangle. More...
 
template<typename Scalar >
Scalar to_degrees (Scalar rad=1)
 Convert radians to degrees. More...
 
template<typename Scalar >
Scalar to_radians (Scalar deg=1)
 Convert degrees to radians. More...
 
template<typename T >
int sign (T val)
 Get the sign of the value Returns either -1, 0, or 1.
 
template<typename Scalar >
Scalar gaussian (Scalar x, Scalar sigma, Scalar center=0)
 Simple evaluation of Gaussian function.
 
template<class T , class... Args>
value_ptr< T > make_value_ptr (Args &&... args)
 Helper function to create a value_ptr for a given type. More...
 
template<typename Scalar , typename Index >
void weld_indexed_attribute (SurfaceMesh< Scalar, Index > &mesh, AttributeId attr_id, const WeldOptions &options={})
 Weld an indexed attribute by combining all corners around a vertex with the same attribute value. More...
 
template<typename TargetScalar , typename TargetIndex , typename SourceScalar , typename SourceIndex >
SurfaceMesh< TargetScalar, TargetIndex > cast (const SurfaceMesh< SourceScalar, SourceIndex > &source_mesh, const AttributeFilter &convertible_attributes, std::vector< std::string > *converted_attributes_names)
 
template<typename Scalar , typename Index >
size_t compute_vertex_based_components (SurfaceMesh< Scalar, Index > &mesh, AttributeId id, span< const Index > blocker_vertices)
 
template<typename Scalar , typename Index >
size_t compute_edge_based_components (SurfaceMesh< Scalar, Index > &mesh, AttributeId id, span< const Index > blocker_edges)
 
void exactinit ()
 
double orient2d (const double *pa, const double *pb, const double *pc)
 
double orient3d (const double *pa, const double *pb, const double *pc, const double *pd)
 
double incircle (const double *pa, const double *pb, const double *pc, const double *pd)
 
double insphere (const double *pa, const double *pb, const double *pc, const double *pd, const double *pe)
 
template<typename Scalar , typename Index >
std::vector< Index > split_edges (SurfaceMesh< Scalar, Index > &mesh, function_ref< span< Index >(Index)> get_edge_split_pts, function_ref< bool(Index)> active_facet)
 Split edges based on the input split points. More...
 
template<typename Scalar , typename Index >
void split_triangle (size_t num_points, span< const Scalar > points, span< const Index > chain, span< Index > visited_buffer, std::vector< Index > &queue_buffer, const Index v0, const Index v1, const Index v2, span< Index > triangulation)
 Split a triangle into smaller triangles based on the chain of splitting points on the edges. More...
 
int grow_expansion (int elen, REAL *e, REAL b, REAL *h)
 
int grow_expansion_zeroelim (int elen, REAL *e, REAL b, REAL *h)
 
int expansion_sum (int elen, REAL *e, int flen, REAL *f, REAL *h)
 
int expansion_sum_zeroelim1 (int elen, REAL *e, int flen, REAL *f, REAL *h)
 
int expansion_sum_zeroelim2 (int elen, REAL *e, int flen, REAL *f, REAL *h)
 
int fast_expansion_sum (int elen, REAL *e, int flen, REAL *f, REAL *h)
 
int fast_expansion_sum_zeroelim (int elen, REAL *e, int flen, REAL *f, REAL *h)
 
int linear_expansion_sum (int elen, REAL *e, int flen, REAL *f, REAL *h)
 
int linear_expansion_sum_zeroelim (int elen, REAL *e, int flen, REAL *f, REAL *h)
 
int scale_expansion (int elen, REAL *e, REAL b, REAL *h)
 
int scale_expansion_zeroelim (int elen, REAL *e, REAL b, REAL *h)
 
int compress (int elen, REAL *e, REAL *h)
 
REAL estimate (int elen, REAL *e)
 
REAL orient2dfast (REAL *pa, REAL *pb, REAL *pc)
 
REAL orient2dexact (REAL *pa, REAL *pb, REAL *pc)
 
REAL orient2dslow (REAL *pa, REAL *pb, REAL *pc)
 
REAL orient2dadapt (const REAL *pa, const REAL *pb, const REAL *pc, REAL detsum)
 
REAL orient2d (const REAL *pa, const REAL *pb, const REAL *pc)
 
REAL orient3dfast (REAL *pa, REAL *pb, REAL *pc, REAL *pd)
 
REAL orient3dexact (REAL *pa, REAL *pb, REAL *pc, REAL *pd)
 
REAL orient3dslow (REAL *pa, REAL *pb, REAL *pc, REAL *pd)
 
REAL orient3dadapt (const REAL *pa, const REAL *pb, const REAL *pc, const REAL *pd, REAL permanent)
 
REAL orient3d (const REAL *pa, const REAL *pb, const REAL *pc, const REAL *pd)
 
REAL incirclefast (REAL *pa, REAL *pb, REAL *pc, REAL *pd)
 
REAL incircleexact (REAL *pa, REAL *pb, REAL *pc, REAL *pd)
 
REAL incircleslow (REAL *pa, REAL *pb, REAL *pc, REAL *pd)
 
REAL incircleadapt (const REAL *pa, const REAL *pb, const REAL *pc, const REAL *pd, REAL permanent)
 
REAL incircle (const REAL *pa, const REAL *pb, const REAL *pc, const REAL *pd)
 
REAL inspherefast (REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe)
 
REAL insphereexact (const REAL *pa, const REAL *pb, const REAL *pc, const REAL *pd, const REAL *pe)
 
REAL insphereslow (REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe)
 
REAL insphereadapt (const REAL *pa, const REAL *pb, const REAL *pc, const REAL *pd, const REAL *pe, REAL permanent)
 
REAL insphere (const REAL *pa, const REAL *pb, const REAL *pc, const REAL *pd, const REAL *pe)
 
template<typename Scalar , typename Index >
void append_triangles_from_quad (const SurfaceMesh< Scalar, Index > &mesh, Index f, std::vector< Index > &new_to_old_corners, std::vector< Index > &new_to_old_facets)
 
template<typename Scalar , typename Index >
Eigen::Vector3< Scalar > facet_normal (const SurfaceMesh< Scalar, Index > &mesh, Index f)
 
template<typename Scalar , typename Index >
auto find_best_2d_axes (const SurfaceMesh< Scalar, Index > &mesh, Index f)
 
template<typename Scalar , typename Index >
void append_triangles_from_polygon (SurfaceMesh< Scalar, Index > &mesh, Index f, std::vector< std::array< Scalar, 2 > > &polygon, mapbox::detail::Earcut< Index > &earcut, std::vector< Index > &new_to_old_corners, std::vector< Index > &new_to_old_facets)
 
 LA_SURFACE_MESH_SCALAR_X (triangle_uv_distortion, 0)
 
template<typename DerivedV , typename DerivedE >
void save_graph_off (const fs::path &filename, const Eigen::MatrixBase< DerivedV > &V, const Eigen::MatrixBase< DerivedE > &E)
 Saves a 2D undirected graph (V,E) using off format. More...
 
template<typename DerivedV , typename DerivedE >
void save_graph (const fs::path &filename, const Eigen::MatrixBase< DerivedV > &V, const Eigen::MatrixBase< DerivedE > &E)
 Saves a 2D undirected graph (V,E) based on filename extension. More...
 
Sequential iteration for read operations
template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor , typename Scalar , typename Index >
void seq_foreach_named_attribute_read (const SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis)
 Applies a function to each attribute of a mesh. More...
 
template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor , typename Scalar , typename Index >
void seq_foreach_attribute_read (const SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis)
 Applies a function to each attribute of a mesh. More...
 
Sequential iteration for write operations
template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor , typename Scalar , typename Index >
void seq_foreach_named_attribute_write (SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis)
 Applies a function to each attribute of a mesh. More...
 
template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor , typename Scalar , typename Index >
void seq_foreach_attribute_write (SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis)
 Applies a function to each attribute of a mesh. More...
 
Parallel iteration for read operations
template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor , typename Scalar , typename Index >
void par_foreach_named_attribute_read (const SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis)
 Applies a function in parallel to each attribute of a mesh. More...
 
template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor , typename Scalar , typename Index >
void par_foreach_attribute_read (const SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis)
 Applies a function in parallel to each attribute of a mesh. More...
 
Parallel iteration for write operations
template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor , typename Scalar , typename Index >
void par_foreach_named_attribute_write (SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis)
 Applies a function in parallel to each attribute of a mesh. More...
 
template<std::underlying_type_t< AttributeElement > mask = BitField<AttributeElement>::all(), typename Visitor , typename Scalar , typename Index >
void par_foreach_attribute_write (SurfaceMesh< Scalar, Index > &mesh, Visitor &&vis)
 Applies a function in parallel to each attribute of a mesh. More...
 
Attribute remapping

Mapping attributes between different element types.

  • When mapping indexed to value attributes, values are duplicated for each corner, since otherwise the mapping corner -> value would be lost.
  • When mapping value to indexed attributes, the size of the value buffer must be equal to the number of corners. The values are not deduplicated in the new indexed attribute.
template<typename Scalar , typename Index >
AttributeId map_attribute (SurfaceMesh< Scalar, Index > &mesh, AttributeId id, std::string_view new_name, AttributeElement new_element)
 Map attribute values to a new attribute with a different element type. More...
 
template<typename Scalar , typename Index >
AttributeId map_attribute (SurfaceMesh< Scalar, Index > &mesh, std::string_view old_name, std::string_view new_name, AttributeElement new_element)
 Map attribute values to a new attribute with a different element type. More...
 
template<typename Scalar , typename Index >
AttributeId map_attribute_in_place (SurfaceMesh< Scalar, Index > &mesh, AttributeId id, AttributeElement new_element)
 Map attribute values to a different element type. More...
 
template<typename Scalar , typename Index >
AttributeId map_attribute_in_place (SurfaceMesh< Scalar, Index > &mesh, std::string_view name, AttributeElement new_element)
 Map attribute values to a different element type. More...
 
Index buffer unification
template<typename Scalar , typename Index >
SurfaceMesh< Scalar, Index > unify_index_buffer (const SurfaceMesh< Scalar, Index > &mesh, const std::vector< AttributeId > &attribute_ids={})
 Unify index buffers of the input mesh for all attributes specified in attribute_ids. More...
 
template<typename Scalar , typename Index >
SurfaceMesh< Scalar, Index > unify_named_index_buffer (const SurfaceMesh< Scalar, Index > &mesh, const std::vector< std::string_view > &attribute_names)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
Generic attribute views
template<typename ValueType >
RowMatrixView< ValueType > matrix_ref (Attribute< ValueType > &attribute)
 Returns a writable view of a given attribute in the form of an Eigen matrix. More...
 
template<typename ValueType >
ConstRowMatrixView< ValueType > matrix_view (const Attribute< ValueType > &attribute)
 Returns a read-only view of a given attribute in the form of an Eigen matrix. More...
 
template<typename ValueType >
VectorView< ValueType > vector_ref (Attribute< ValueType > &attribute)
 Returns a writable view of a scalar attribute in the form of an Eigen vector. More...
 
template<typename ValueType >
ConstVectorView< ValueType > vector_view (const Attribute< ValueType > &attribute)
 Returns a read-only view of a scalar attribute in the form of an Eigen vector. More...
 
template<typename ValueType >
RowMatrixView< ValueType > reshaped_ref (Attribute< ValueType > &attribute, size_t num_cols)
 Returns a writable view of a given single-channel attribute in the form of an Eigen matrix with a prescribed number of columns. More...
 
template<typename ValueType >
ConstRowMatrixView< ValueType > reshaped_view (const Attribute< ValueType > &attribute, size_t num_cols)
 Returns a read-only view of a given single-channel attribute in the form of an Eigen matrix with a prescribed number of columns. More...
 
Generic attribute views (mesh)
template<typename ValueType , typename Scalar , typename Index >
RowMatrixView< ValueType > attribute_matrix_ref (SurfaceMesh< Scalar, Index > &mesh, std::string_view name)
 Returns a writable view of a mesh attribute in the form of an Eigen matrix. More...
 
template<typename ValueType , typename Scalar , typename Index >
RowMatrixView< ValueType > attribute_matrix_ref (SurfaceMesh< Scalar, Index > &mesh, AttributeId id)
 Returns a writable view of a mesh attribute in the form of an Eigen matrix. More...
 
template<typename ValueType , typename Scalar , typename Index >
ConstRowMatrixView< ValueType > attribute_matrix_view (const SurfaceMesh< Scalar, Index > &mesh, std::string_view name)
 Returns a read-only view of a mesh attribute in the form of an Eigen matrix. More...
 
template<typename ValueType , typename Scalar , typename Index >
ConstRowMatrixView< ValueType > attribute_matrix_view (const SurfaceMesh< Scalar, Index > &mesh, AttributeId id)
 Returns a read-only view of a mesh attribute in the form of an Eigen matrix. More...
 
template<typename ValueType , typename Scalar , typename Index >
VectorView< ValueType > attribute_vector_ref (SurfaceMesh< Scalar, Index > &mesh, std::string_view name)
 Returns a writable view of a mesh attribute in the form of an Eigen vector. More...
 
template<typename ValueType , typename Scalar , typename Index >
VectorView< ValueType > attribute_vector_ref (SurfaceMesh< Scalar, Index > &mesh, AttributeId id)
 Returns a writable view of a mesh attribute in the form of an Eigen vector. More...
 
template<typename ValueType , typename Scalar , typename Index >
ConstVectorView< ValueType > attribute_vector_view (const SurfaceMesh< Scalar, Index > &mesh, std::string_view name)
 Returns a read-only view of a mesh attribute in the form of an Eigen vector. More...
 
template<typename ValueType , typename Scalar , typename Index >
ConstVectorView< ValueType > attribute_vector_view (const SurfaceMesh< Scalar, Index > &mesh, AttributeId id)
 Returns a read-only view of a mesh attribute in the form of an Eigen vector. More...
 
Specific attribute views
template<typename Scalar , typename Index >
RowMatrixView< Scalar > vertex_ref (SurfaceMesh< Scalar, Index > &mesh)
 Returns a writable view of the mesh vertices in the form of an Eigen matrix. More...
 
template<typename Scalar , typename Index >
ConstRowMatrixView< Scalar > vertex_view (const SurfaceMesh< Scalar, Index > &mesh)
 Returns a read-only view of the mesh vertices in the form of an Eigen matrix. More...
 
template<typename Scalar , typename Index >
RowMatrixView< Index > facet_ref (SurfaceMesh< Scalar, Index > &mesh)
 Returns a writable view of a mesh facets in the form of an Eigen matrix. More...
 
template<typename Scalar , typename Index >
ConstRowMatrixView< Index > facet_view (const SurfaceMesh< Scalar, Index > &mesh)
 Returns a read-only view of a mesh facets in the form of an Eigen matrix. More...
 

Detailed Description

Main namespace for Lagrange.

This header exposes functionality of previously registered mesh types To register new mesh type, include <lagrange/ui/utils/mesh.impl.h> and call register_mesh_type<MeshType>

Events triggered by the default systems Use ui::on<Event>(registry, [](Event& e){}) to register a listener Use ui::publish<Event>(registry, args ...) to trigger a custom event See <lagrange/ui/utils/events.h> for more details.

Private methods.

Utility functions that don't belong anywhere else.

Evaluates a function for each mesh element and stores the result as an attribute.

Consider refactoring this file if it becomes too big, or categories emerge.

Enumeration Type Documentation

◆ ReorderingMethod

enum class ReorderingMethod
strong

Mesh reordering method to apply before decimation.

Enumerator
Lexicographic 

Sort vertices/facets lexicographically.

Morton 

Spatial sort vertices/facets using Morton encoding.

Hilbert 

Spatial sort vertices/facets using Hilbert curve.

None 

Do not reorder mesh vertices/facets.

◆ ConnectivityType

enum class ConnectivityType
strong

This type defines the condition when two facets are considered as "connected".

Enumerator
Vertex 

Two facets are considered connected if they share a vertex.

Edge 

Two facets are considered connected if they share an edge.

◆ MappingPolicy

enum class MappingPolicy
strong

Mapping policy control the behavior when two or more elements are mapped into the same output element.

Enumerator
Average 

Take the average of all involved elements.

KeepFirst 

Keep the value of the first elements.

Error 

Throw an error if collision is detected.

Function Documentation

◆ chain_corners_around_edges()

void chain_corners_around_edges ( const Eigen::MatrixBase< DerivedF > &  facets,
const Eigen::MatrixBase< DerivedC > &  corner_to_edge,
Eigen::PlainObjectBase< DerivedE > &  edge_to_corner,
Eigen::PlainObjectBase< DerivedN > &  next_corner_around_edge 
)

Chains facet corners around edges of a mesh.

The mesh is assumed have polygonal faces of constant degree k. There are #C = #F * k facet corners in this mesh.

Parameters
[in]facets#F x k array of facet indices.
[in]corner_to_edge#C x 1 array mapping facet corners to edge indices.
[out]edge_to_corner#E x 1 array of first facet corner in the chain starting from a given edge.
[out]next_corner_around_edge#C x 1 array of next facet corner in the chain at a given facet corner.
Template Parameters
DerivedFType of facet array.
DerivedCType of corner to edge vector.
DerivedEType of edge to corner vector.
DerivedNType of next corner vector.

◆ chain_corners_around_vertices()

void chain_corners_around_vertices ( typename DerivedF::Scalar  num_vertices,
const Eigen::MatrixBase< DerivedF > &  facets,
Eigen::PlainObjectBase< DerivedE > &  vertex_to_corner,
Eigen::PlainObjectBase< DerivedN > &  next_corner_around_vertex 
)

Chains facet corners around vertices of a mesh.

The mesh is assumed have polygonal faces of constant degree k. There are #C = #F * k facet corners in this mesh.

Parameters
[in]num_verticesNumber of vertices in the mesh. This information is necessary since there may be isolated vertices, and thus computing it from the facet array may be misleading.
[in]facets#F x k array of facet indices.
[out]vertex_to_corner#E x 1 array of first facet corner in the chain starting from a given vertex.
[out]next_corner_around_vertex#C x 1 array of next facet corner in the chain at a given facet corner.
Template Parameters
DerivedFType of facet array.
DerivedEType of vertex to corner vector.
DerivedNType of next corner vector.

◆ move_data()

void move_data ( Eigen::DenseBase< Derived1 > &  from,
Eigen::DenseBase< Derived2 > &  to 
)

Move data from one Eigen obj to another.

Both objects will be in valid state after the move.

◆ compute_lift_operator_from_sampling()

auto compute_lift_operator_from_sampling ( const MeshType mesh,
const Cloud &  closest_points,
const Indices &  element_indices 
)

This compute the sparse bilinear map from mesh vertex attributes to point cloud attributes.

Input points are supposed to lie on facets on the input mesh. Each row of element_indices is a input triangle index of which the point at the same row is supposed to lie. It uses barycentric coordinates on each triangle to fill in coeffs of a sparse matrix which is then returned. This bilinear sparse mapping (a.k.a. the returned sparse matrix) can used extend mesh defined fields to fields defined in R^3. This is useful for interpolating positions or scalar curvatures to a sampled point cloud for example. This is suited for use with sampling functions like random_sample_uniform that naturally build the third arg.

Returns
Sparse n*m matrix, where n is the number of vertex in the input mesh and m is the number of vertex in the input point cloud.
Parameters
[in]meshInput triangular mesh.
[in]closest_pointsInput point cloud. should lie on input mesh.
[in]element_indicesInput mesh triangle indices for each point of the input point cloud.

◆ compute_lift_operator_from_projections()

auto compute_lift_operator_from_projections ( const MeshType mesh,
const ClosestPoints &  projections 
)

This compute the sparse bilinear map from mesh vertex attributes to point cloud attributes.

It uses barycentric coordinates on each triangle to fill in coeffs of a sparse matrix which is then returned. This bilinear sparse mapping (a.k.a. the returned sparse matrix) can used extend mesh defined fields to fields defined in R^3. This is useful for interpolating positions or scalar curvatures to a sampled point cloud for example. This is suited for use with bvh structure whose data return by batch_query can be used as the second arg.

Returns
Sparse n*m matrix, where n is the number of vertex in the input mesh and m is the number of vertex in the input point cloud.
Parameters
[in]meshinput triangular mesh.
[in]projectionsprojections data returned by a call to BVH batch_query.

◆ compute_mesh_covariance()

std::array< std::array< Scalar, 3 >, 3 > compute_mesh_covariance ( const SurfaceMesh< Scalar, Index > &  mesh,
const MeshCovarianceOptions options = {} 
)

Compute the covariance matrix w.r.t.

a given center (default to zeros).

Parameters
[in]meshThe input mesh.
[in]optionsOptional arguments.
Template Parameters
ScalarThe scalar type of the mesh.
IndexThe index type of the mesh.
Returns
The covariance matrix in column-major order (but it should be symmetric).
See also
MeshCovarianceOptions. Adapted from https://github.com/mkazhdan/ShapeSPH/blob/master/Util/TriangleMesh.h#L101

◆ compute_pointcloud_pca()

PointcloudPCAOutput< Scalar > compute_pointcloud_pca ( span< const Scalar >  points,
ComputePointcloudPCAOptions  options = {} 
)

Finds the principal components for a pointcloud.

Assumes that the points are supplied in a matrix where each `‘row’' is a point.

This is closely related to the inertia tensor, principal directions and principal moments. But it is not exactly the same.

COVARIANCE_MATRIX (tensor) = (P-eC)^T (P-eC) Where C is the centroid, and e is column vector of ones. eigenvalues and eigenvectors of this matrix would be the principal weights and components.

MOMENT OF INERTIA (tensor) = trace(P^T P)I - P^T P eigenvalues and eigenvectors of this matrix would be the principal moments and directions.

Parameters
[in]pointsThe input points.
[in]optionsOptions struct, see above.
Returns
PointCloudPCAOutput Contains center, eigenvectors (components) and eigenvalues (weights). See above for more details.

◆ compute_seam_edges()

AttributeId compute_seam_edges ( SurfaceMesh< Scalar, Index > &  mesh,
AttributeId  indexed_attribute_id,
const SeamEdgesOptions options = {} 
)

Computes the seam edges for a given indexed attribute.

A seam edge is an edge where either of its endpoint vertex has corners whose attribute index differ across the edge.

Parameters
[in,out]meshInput mesh. Modified to add edge information and compute output seam edges.
[in]indexed_attribute_idId of the indexed attribute for which to compute seam edges.
[in]optionsOptional parameters.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.
Returns
Id of the newly added per-edge attribute. The newly computed attribute will have value type uint8_t, and contain 0 for non-seam edges, and 1 for seam edges.

◆ corner_to_edge_mapping()

Eigen::Index corner_to_edge_mapping ( const Eigen::MatrixBase< DerivedF > &  F,
Eigen::PlainObjectBase< DerivedC > &  C2E 
)

Computes a mapping from mesh corners (k*f+i) to unique edge ids.

Parameters
[in]F#F x k matrix of facet indices.
[out]C2E#F*k vector of unique edge ids per corner.
Template Parameters
DerivedFType of facet array.
DerivedCType of corner to edge vector.
Returns
Number of unique edges created.

◆ create_mesh() [1/2]

auto create_mesh ( const Eigen::MatrixBase< DerivedV > &  vertices,
const Eigen::MatrixBase< DerivedF > &  facets 
)

This function create a new mesh given the vertex and facet arrays by copying data into the Mesh object.

Both arrays can be of type Eigen::Matrix or Eigen::Map.

◆ create_mesh() [2/2]

std::unique_ptr< Mesh< DerivedV, DerivedF > > create_mesh ( Eigen::PlainObjectBase< DerivedV > &&  vertices,
Eigen::PlainObjectBase< DerivedF > &&  facets 
)

This function create a new mesh given the vertex and facet arrays by moving data into the Mesh object.

Both arrays must be of type Eigen::Matrix.

◆ wrap_with_mesh()

auto wrap_with_mesh ( const Eigen::MatrixBase< VertexArray > &  vertices,
const Eigen::MatrixBase< FacetArray > &  facets 
)

This method creates a Mesh object that wraps around vertices and facets.

Warning: vertices and facets are referenced instead of copied, and thus they have to be valid throughout the duration of the lifetime of the object. It is the user's responsibility of ensure it is the case.

◆ close_small_holes()

std::unique_ptr< MeshType > close_small_holes ( MeshType mesh,
size_t  max_hole_size 
)

Close small topological holes.

For holes with > 3 vertices, inserts a vertex at the barycenter of the hole polygon. If a hole is not a simple polygon, we attempt to turn it into simple polygons by cutting ears.

Todo:
Remap attribute. For now all input mesh attributes are dropped.
Parameters
[in]meshInput mesh whose holes to close.
[in]max_hole_sizeMaximum number of vertices on a hole to be closed.
Template Parameters
MeshTypeMesh type.
Returns
A new mesh with the holes closed.

◆ detect_degenerate_facets()

std::vector< Index > detect_degenerate_facets ( const SurfaceMesh< Scalar, Index > &  mesh)

Detects degenerate facets in a mesh.

Parameters
meshInput mesh.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.
Returns
A vector of indices of degenerate facets.
Note
Only exactly degenerate facets are detected. For polygonal facets, degeneracy is defined as all vertices are colinear.
See also
remove_degenerate_facets

◆ remove_degenerate_facets()

void remove_degenerate_facets ( SurfaceMesh< Scalar, Index > &  mesh)

Removes degenerate facets from a mesh.

Note
This method currently only works with triangular meshes. Only exactly degenerate facets are detected.
Parameters
[in,out]meshInput mesh which will be modified in place.
Note
The current method assumes input mesh is triangular. Use triangulate_polygonal_facets if the input mesh is not triangular. Non-degenerate facets adjacent to degenerate facets may be re-triangulated as a result of the removal.

◆ remove_duplicate_facets()

void remove_duplicate_facets ( SurfaceMesh< Scalar, Index > &  mesh,
const RemoveDuplicateFacetOptions opts = {} 
)

Remove duplicate facets in the mesh.

Template Parameters
ScalarMesh scalar type
IndexMesh index type

@paramp[in,out] mesh Input mesh

Parameters
[in]optsOptions
Note
If opts.consider_orientation is false, facets with opposite orientations (e.g. (0, 1, 2) and (2, 1, 0)) are considered as duplicates. If the two orientations have equal number of duplicate facets, all of them will be removed. Otherwise, only one facet with the majority orientation will be kept.

◆ remove_duplicate_vertices()

void remove_duplicate_vertices ( SurfaceMesh< Scalar, Index > &  mesh,
const RemoveDuplicateVerticesOptions options = {} 
)

Removes duplicate vertices from a mesh.

Template Parameters
ScalarMesh scalar type
IndexMesh index type
Parameters
[in,out]meshThe mesh to remove duplicate vertices from.
optionsThe options for duplicate vertex detection.

◆ remove_isolated_vertices()

void remove_isolated_vertices ( SurfaceMesh< Scalar, Index > &  mesh)

Removes isolated vertices of a mesh.

Facets incident to any removed vertex will be deleted.

Parameters
meshMesh to modify in place.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ remove_null_area_facets()

void remove_null_area_facets ( SurfaceMesh< Scalar, Index > &  mesh,
const RemoveNullAreaFacetsOptions options = {} 
)

Removes all facets with unsigned area <= options.null_area_threshold.

Template Parameters
ScalarMesh scalar type.
IndexMesh index type.
Parameters
[in,out]meshInput mesh.
[in]optionsOptions settings for removing null area facets.

◆ remove_short_edges()

void remove_short_edges ( SurfaceMesh< Scalar, Index > &  mesh,
Scalar  threshold = 0 
)

Collapse all edges shorter than a given tolerance.

Parameters
meshInput mesh to be updated in place.
thresholdEdges with length <= threshold will be removed.

◆ remove_topologically_degenerate_facets()

void remove_topologically_degenerate_facets ( SurfaceMesh< Scalar, Index > &  mesh)

Remove topologically degenerate facets (i.e.

triangles like (0, 1, 1)).

Non-triangle polygons are not handled at the moment.

Template Parameters
ScalarThe surface mesh scalar type.
IndexThe surface mesh index type.
Parameters
[in,out]meshThe surface mesh (for in-place modification).

◆ resolve_nonmanifoldness()

void resolve_nonmanifoldness ( SurfaceMesh< Scalar, Index > &  mesh)

Resolve both non-manifold vertices and non-manifold edges in the input mesh.

Template Parameters
ScalarMesh scalar type
IndexMesh index type
Parameters
meshInput mesh, which will be updated in place

◆ resolve_vertex_nonmanifoldness()

void resolve_vertex_nonmanifoldness ( SurfaceMesh< Scalar, Index > &  mesh)

Resolve nonmanifold vertices by pulling disconnected 1-ring neighborhood apart.

Template Parameters
ScalarThe scalar type.
IndexThe index type.
Parameters
[in,out]meshThe input mesh, which will be updated in place.
Warning
This function assumes the input mesh contains no nonmanifold edges or inconsistently oriented triangles.

◆ split_long_edges()

void split_long_edges ( SurfaceMesh< Scalar, Index > &  mesh,
SplitLongEdgesOptions  options = {} 
)

Split edges that are longer than options.max_edge_length.

Parameters
[in,out]meshInput mesh.
[in]optionsOptional settings.

◆ orient_outward()

void orient_outward ( lagrange::SurfaceMesh< Scalar, Index > &  mesh,
const OrientOptions options = {} 
)

Orient the facets of a mesh so that the signed volume of each connected component is positive or negative.

Parameters
[in,out]meshMesh whose facets needs to be re-oriented.
[in]optionsOrientation options.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ reorder_mesh()

void reorder_mesh ( SurfaceMesh< Scalar, Index > &  mesh,
ReorderingMethod  method 
)

Mesh reordering to improve cache locality.

Reorder mesh vertices using Morton encoding.

The reordering is done in place.

Parameters
[in,out]meshMesh to reorder in place. For now we only support triangle meshes.
[in]methodReordering method.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.
Todo:
Reorder mesh facets as well.
Parameters
[in,out]meshMesh to reorder.
Template Parameters
MeshTypeMesh type.

◆ segment_segment_squared_distance()

auto segment_segment_squared_distance ( const Eigen::MatrixBase< PointType > &  U0,
const Eigen::MatrixBase< PointType > &  U1,
const Eigen::MatrixBase< PointType > &  V0,
const Eigen::MatrixBase< PointType > &  V1,
Eigen::PlainObjectBase< PointType > &  closest_pointU,
Eigen::PlainObjectBase< PointType > &  closest_pointV,
ScalarOf< PointType > &  lambdaU,
ScalarOf< PointType > &  lambdaV 
) -> ScalarOf<PointType>

Computes the squared distance between two N-d line segments, and the closest pair of points whose separation is this distance.

Parameters
[in]U0first extremity of the first segment
[in]U1second extremity of the first segment
[in]V0first extremity of the second segment
[in]V1second extremity of the second segment
[out]closest_pointUthe closest point on segment [U0, U1]
[out]closest_pointVthe closest point on segment [V0, V1]
[out]lambdaUbarycentric coordinate of the closest point relative to [U0, U1]
[out]lambdaVbarycentric coordinate of the closest point relative to [V0, V1]
Template Parameters
PointTypethe class that represents the points.
Returns
the squared distance between the segments [U0, U1] and [V0, V1]
Note
Adapted from Real-Time Collision Detection by Christer Ericson, published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc. This function was modified for use by Siddhartha Chaudhuri in the Thea library, from where this version was taken on 28 Sep 2022. All modifications beyond Thea are Copyright 2022 Adobe.

◆ thicken_and_close_mesh()

SurfaceMesh< Scalar, Index > thicken_and_close_mesh ( SurfaceMesh< Scalar, Index >  input_mesh,
const ThickenAndCloseOptions options = {} 
)

Thicken a mesh by offsetting it, and close the shape into a thick 3D solid.

Input mesh vertices are duplicated and can additionally be mirrored wrt to a plane going through the origin.

Parameters
[in]input_meshInput mesh, assumed to have a disk topology. Must have edge information included.
[in]optionsThickening options.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.
Returns
A mesh thickened into a 3D solid shape.

◆ cos_angle_between()

Scalar cos_angle_between ( const Eigen::Matrix< Scalar, _Rows, _Cols > &  v1,
const Eigen::Matrix< Scalar, _Rows, _Cols > &  v2 
)

Returns the cosine of the angle between two 3d vectors.

Assumes both vectors are normalized (unit vector).

◆ project_on_line()

Eigen::Matrix< Scalar, _Rows, _Cols > project_on_line ( const Eigen::Matrix< Scalar, _Rows, _Cols > &  v1,
const Eigen::Matrix< Scalar, _Rows, _Cols > &  v2 
)

Project the vector v1 on the line defined by its vector v2.

Assumes the vector v2 is normalized (unit vector).

◆ project_on_plane()

Eigen::Matrix< Scalar, _Rows, _Cols > project_on_plane ( const Eigen::Matrix< Scalar, _Rows, _Cols > &  v,
const Eigen::Matrix< Scalar, _Rows, _Cols > &  n 
)

Project the vector on the plane defined by its normal n.

Assumes the normal n is a unit vector.

◆ projected_cos_angle_between()

Scalar projected_cos_angle_between ( const Eigen::Matrix< Scalar, _Rows, _Cols > &  v1,
const Eigen::Matrix< Scalar, _Rows, _Cols > &  v2,
const Eigen::Matrix< Scalar, _Rows, _Cols > &  n 
)

Returns the angle between the vectors v1 and v2 projected on the plane defined by its normal n.

Assumes the normal n is a unit vector.

◆ projected_angle_between()

Scalar projected_angle_between ( const Eigen::Matrix< Scalar, _Rows, _Cols > &  v1,
const Eigen::Matrix< Scalar, _Rows, _Cols > &  v2,
const Eigen::Matrix< Scalar, _Rows, _Cols > &  n 
)

Returns the angle between the vectors v1 and v2 projected on the plane defined by its normal n.

Assumes the normal n is a unit vector.

◆ vector_between()

auto vector_between ( const MeshType mesh,
typename MeshType::Index  v1,
typename MeshType::Index  v2 
)

Returns the vector from v1 to v2.

Parameters
[in]v1first vertex index (from).
[in]v2second vertex index (to)
Returns
The 3D vector

◆ orthogonal_frame()

void orthogonal_frame ( const Eigen::Matrix< Scalar, 3, 1 > &  x,
Eigen::Matrix< Scalar, 3, 1 > &  y,
Eigen::Matrix< Scalar, 3, 1 > &  z 
)

Build an orthogonal frame given a single vector.

Parameters
[in]xFirst vector of the frame.
[out]ySecond vector of the frame.
[out]zThird vector of the frame.
Template Parameters
ScalarScalar type.

◆ point_on_segment()

bool point_on_segment ( const Eigen::MatrixBase< PointType > &  p,
const Eigen::MatrixBase< PointType > &  a,
const Eigen::MatrixBase< PointType > &  b 
)

Test if a point lies exactly on a segment [a,b] using exact predicates.

If the points are collinear, each individual coordinate is examined to determine if the query point lies inside the segment or outside of it.

Parameters
[in]pQuery point.
[in]aFirst segment endpoint.
[in]bSecond segment endpoint.
Template Parameters
PointTypePoint type.
Returns
True if the query point lies exactly on the segment, False otherwise.

◆ point_segment_squared_distance() [1/2]

auto point_segment_squared_distance ( const Eigen::MatrixBase< PointType > &  point,
const Eigen::MatrixBase< PointType > &  V0,
const Eigen::MatrixBase< PointType > &  V1,
Eigen::PlainObjectBase< PointType > &  closest_point,
ScalarOf< PointType > &  lambda0,
ScalarOf< PointType > &  lambda1 
) -> ScalarOf<PointType>

Computes the point closest to a given point in a nd segment.

Parameters
[in]pointthe query point
[in]V0first extremity of the segment
[in]V1second extremity of the segment
[out]closest_pointthe point closest to point in the segment [V0, V1]
[out]lambda0barycentric coordinate of the closest point relative to V0
[out]lambda1barycentric coordinate of the closest point relative to V1
Template Parameters
PointTypethe class that represents the points.
Returns
the squared distance between the point and the segment [V0, V1]

◆ point_segment_squared_distance() [2/2]

auto point_segment_squared_distance ( const Eigen::MatrixBase< PointType > &  point,
const Eigen::MatrixBase< PointType > &  V0,
const Eigen::MatrixBase< PointType > &  V1 
) -> ScalarOf<PointType>

Computes the point closest to a given point in a nd segment.

Parameters
[in]pointthe query point
[in]V0first extremity of the segment
[in]V1second extremity of the segment
Template Parameters
PointTypethe class that represents the points.
Returns
the squared distance between the point and the segment [V0, V1]

◆ point_triangle_squared_distance() [1/2]

auto point_triangle_squared_distance ( const Eigen::MatrixBase< PointType > &  point,
const Eigen::MatrixBase< PointType > &  V0,
const Eigen::MatrixBase< PointType > &  V1,
const Eigen::MatrixBase< PointType > &  V2,
Eigen::PlainObjectBase< PointType > &  closest_point,
ScalarOf< PointType > &  lambda0,
ScalarOf< PointType > &  lambda1,
ScalarOf< PointType > &  lambda2 
) -> ScalarOf<PointType>

Computes the point closest to a given point in a nd triangle.

See http://www.geometrictools.com/LibMathematics/Distance/Distance.html

Parameters
[in]pointthe query point
[in]V0first vertex of the triangle
[in]V1second vertex of the triangle
[in]V2third vertex of the triangle
[out]closest_pointthe point closest to point in the triangle (V0, V1, V2)
[out]lambda0barycentric coordinate of the closest point relative to V0
[out]lambda1barycentric coordinate of the closest point relative to V1
[out]lambda2barycentric coordinate of the closest point relative to V2
Template Parameters
PointTypethe class that represents the points.
Returns
the squared distance between the point and the triangle (V0, V1, V2)

◆ point_triangle_squared_distance() [2/2]

auto point_triangle_squared_distance ( const Eigen::MatrixBase< PointType > &  point,
const Eigen::MatrixBase< PointType > &  V0,
const Eigen::MatrixBase< PointType > &  V1,
const Eigen::MatrixBase< PointType > &  V2 
) -> ScalarOf<PointType>

Computes the squared distance between a point and a nd triangle.

See http://www.geometrictools.com/LibMathematics/Distance/Distance.html

Parameters
[in]pointthe query point
[in]V0first vertex of the triangle
[in]V1second vertex of the triangle
[in]V2third vertex of the triangle
Template Parameters
PointTypethe class that represents the points.
Returns
the squared distance between the point and the triangle (V0, V1, V2)

◆ quad_area_2d()

Scalar quad_area_2d ( span< const Scalar, 2 >  a,
span< const Scalar, 2 >  b,
span< const Scalar, 2 >  c,
span< const Scalar, 2 >  d 
)

Compute 2D quad signed area.

Template Parameters
ScalarThe scalar type.
Parameters
a,b,c,dQuad vertex coordinates in counterclockwise order.
Returns
The signed area of the quad.

◆ quad_area_3d()

Scalar quad_area_3d ( span< const Scalar, 3 >  a,
span< const Scalar, 3 >  b,
span< const Scalar, 3 >  c,
span< const Scalar, 3 >  d 
)

Compute 3D quad area.

Template Parameters
ScalarThe scalar type.
Parameters
a,b,c,dQuad vertex coordinates in counterclockwise order.
Returns
The area of the quad.

◆ triangle_area_3d()

Scalar triangle_area_3d ( span< const Scalar, 3 >  a,
span< const Scalar, 3 >  b,
span< const Scalar, 3 >  c 
)

Compute 3D triangle area.

Template Parameters
ScalarThe scalar type.
Parameters
a,b,cTriangle vertex coordinates in counterclockwise order.
Returns
The area of the triangle.

◆ triangle_area_2d()

Scalar triangle_area_2d ( span< const Scalar, 2 >  a,
span< const Scalar, 2 >  b,
span< const Scalar, 2 >  c 
)

Compute 2D triangle signed area.

Template Parameters
ScalarThe scalar type.
Parameters
a,b,cTriangle vertex coordinates in counterclockwise order.
Returns
The signed area of the triangle.

◆ triangle_orientation()

enum lagrange::Orientation short triangle_orientation ( span< const Scalar, 2 >  a,
span< const Scalar, 2 >  b,
span< const Scalar, 2 >  c 
)

Compute orientation of a 2D triangle.

Template Parameters
ScalarThe scalar type.
Parameters
a,b,c2D coordinates of the triangle.
Returns
Orientation::Positive if positively oriented. Orientation::Negative if negatively oriented. Orientation::Zero if the triangle is degenerate.

◆ triangle_uv_distortion() [1/2]

Scalar triangle_uv_distortion ( span< const Scalar, 3 >  V0,
span< const Scalar, 3 >  V1,
span< const Scalar, 3 >  V2,
span< const Scalar, 2 >  v0,
span< const Scalar, 2 >  v1,
span< const Scalar, 2 >  v2 
)

Compute uv distortion of a single triangle.

Let φ be the mapping from the 3D triangle (V0, V1, V2) to the uv triangle (v0, v1, v2), and let J = ∇φ be its Jacobian. A distortion metric measures the amount of deviation from isotropic or conformal mapping. It can often be expressed concisely in terms of the singular values, (s0, s1) of J. Here are a list of supported distortion metrics:

  • Dirichlet: s0*s0 + s1*s1
  • Inverse Dirichlet: 1/(s0*s0) + 1/(s1*s1)
  • Symmetric Dirichlet: s0*s0 + s1*s1 + 1/(s0*s0) + 1/(s1*s1)
  • MIPS: s0/s1 + s1/s0
  • Area ratio: s0*s1
Note
While it is easy to express distortion measures in terms of s0 and s1, it is often computationally unstable or expensive to explicitly compute these singular values. Instead, this method computes the distortion measures geometrically.
Template Parameters
metricThe type of distortion metric to use.
ScalarThe scalar type.
Parameters
V0,V1,V2The coordinates of the 3D triangle.
v0,v1,v2The coordinates of the uv triangle.
Returns
The distortion measure of the uv mapping for this triangle.

◆ triangle_uv_distortion() [2/2]

Scalar triangle_uv_distortion ( span< const Scalar, 3 >  V0,
span< const Scalar, 3 >  V1,
span< const Scalar, 3 >  V2,
span< const Scalar, 2 >  v0,
span< const Scalar, 2 >  v1,
span< const Scalar, 2 >  v2,
DistortionMetric  metric 
)

Compute uv distortion of a single triangle.

Template Parameters
ScalarThe scalar type.
Parameters
V0,V1,V2The coordinates of the 3D triangle.
v0,v1,v2The coordinates of the uv triangle.
metricThe distorsion metric to compute.
Returns
The distortion measure of the uv mapping for this triangle.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ to_degrees()

Scalar to_degrees ( Scalar  rad = 1)

Convert radians to degrees.

Use either as to_degrees(x) or x * to_degrees<double>();

◆ to_radians()

Scalar to_radians ( Scalar  deg = 1)

Convert degrees to radians.

Use either as to_degrees(x) or x * to_degrees<double>();

◆ split_edges()

std::vector< Index > split_edges ( SurfaceMesh< Scalar, Index > &  mesh,
function_ref< span< Index >(Index)>  get_edge_split_pts,
function_ref< bool(Index)>  active_facet 
)

Split edges based on the input split points.

Parameters
meshInput mesh which will be updated in place. All potential splits should be represented as vertices in the mesh. The mesh will be updated in place.
get_edge_split_ptsA function that returns the split points for each edge. The function takes an edge ID as input and returns a span of vertex indices representing the split pts.
active_facetA function that takes a facet ID as input and returns true if the facet is active. Only active facets will be split.
Returns
A vector of original facet IDs that were split.

◆ split_triangle()

void split_triangle ( size_t  num_points,
span< const Scalar >  points,
span< const Index >  chain,
span< Index >  visited_buffer,
std::vector< Index > &  queue_buffer,
const Index  v0,
const Index  v1,
const Index  v2,
span< Index >  triangulation 
)

Split a triangle into smaller triangles based on the chain of splitting points on the edges.

Parameters
num_pointsTotal number of points.
pointsCoordinates of the points.
chainChain of indices into points that iterates all vertices and splitting points in counterclockwise order around the triangle.
visited_bufferTemporary buffer that should be of size 3 * chain.size().
queue_bufferTemporary buffer used for priority queue.
v0Index of the first corner of the input triangle in chain.
v1Index of the second corner of the input triangle in chain.
v2Index of the third corner of the input triangle in chain.
[out]triangulationThe (n-2) by 3 array of output triangles, where n is the size of the chain.

◆ save_graph_off()

void save_graph_off ( const fs::path &  filename,
const Eigen::MatrixBase< DerivedV > &  V,
const Eigen::MatrixBase< DerivedE > &  E 
)

Saves a 2D undirected graph (V,E) using off format.

Parameters
[in]filenameTarget filename path.
[in]V#V x 2 array of vertices positions.
[in]E#E x 2 array of edge indices.
Template Parameters
DerivedVVertex array type.
DerivedEEdge array type.

◆ save_graph()

void save_graph ( const fs::path &  filename,
const Eigen::MatrixBase< DerivedV > &  V,
const Eigen::MatrixBase< DerivedE > &  E 
)

Saves a 2D undirected graph (V,E) based on filename extension.

For now only .off is supported.

Parameters
[in]filenameTarget filename path.
[in]V#V x 2 array of vertices positions.
[in]E#E x 2 array of edge indices.
Template Parameters
DerivedVVertex array type.
DerivedEEdge array type.