OpenABF 2.1.0
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
OpenABF Namespace Reference

OpenABF top-level namespace More...

Namespaces

namespace  detail
 Implementation details.
 
namespace  io_formats
 Mesh IO support for various file formats.
 
namespace  io_utils
 Mesh IO utility functions.
 
namespace  traits
 Traits for meshes and algorithms.
 

Classes

class  ABF
 Compute parameterized interior angles using Angle-based flattening. More...
 
class  ABFPlusPlus
 Compute parameterized interior angles using ABF++. More...
 
class  AngleBasedLSCM
 Compute parameterized mesh using Angle-based LSCM. More...
 
class  HalfEdgeMesh
 Half-edge mesh class. More...
 
class  HierarchicalLSCM
 Compute parameterized mesh using Hierarchical LSCM. More...
 
struct  MergedMesh
 Result of merging several meshes into one. More...
 
class  MeshException
 Solver exception. More...
 
struct  PackOptions
 Options controlling PackCharts behavior. More...
 
struct  PackResult
 The bounding box of the packed atlas. More...
 
class  SolverException
 Solver exception. More...
 
class  Vec
 N-dimensional vector class. More...
 

Typedefs

using Vec3f = Vec< float, 3 >
 3D, 32-bit float vector
 
using Vec3d = Vec< double, 3 >
 3D, 64-bit float vector
 

Enumerations

enum class  Norm { L1 , L2 , LInf }
 Norm type enumeration. More...
 

Functions

template<typename T1 , typename T2 >
auto dot (const T1 &a, const T2 &b)
 Vector dot product (inner product)
 
template<typename T1 , typename T2 >
auto cross (const T1 &a, const T2 &b) -> T1
 Vector cross product.
 
template<class Vector >
auto norm (const Vector &v, Norm norm=Norm::L2)
 Compute vector norm.
 
template<class Vector >
auto normalize (Vector v)
 Normalize a vector (i.e. compute a unit vector)
 
template<class Vector1 , class Vector2 >
auto interior_angle (const Vector1 &a, const Vector2 &b)
 Compute the interior angle between two vectors.
 
template<typename T = float, typename T2 , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr auto to_radians (T2 deg) -> T
 Convert degrees to radians.
 
template<typename T = float, typename T2 , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr auto to_degrees (T2 rad) -> T
 Convert radians to degrees.
 
template<typename T , std::size_t Dims>
std::ostream & operator<< (std::ostream &os, const Vec< T, Dims > &vec)
 
template<class FacePtr >
void ComputeFaceAngles (FacePtr &face)
 Compute the internal angles of a face.
 
template<class MeshPtr >
void ComputeMeshAngles (MeshPtr &mesh)
 Compute the internal angles for all faces in a mesh.
 
template<class MeshPtr >
auto HasBoundary (const MeshPtr &mesh) -> bool
 Determines if mesh is open or closed.
 
template<class MeshPtr >
auto HasUnreferencedVertices (const MeshPtr &mesh) -> bool
 Check if a mesh has unreferenced vertices.
 
template<class MeshPtr >
auto UnreferencedVertices (const MeshPtr &mesh) -> std::vector< std::size_t >
 Get a list of unreferenced vertices.
 
template<class MeshPtr >
auto IsManifold (const MeshPtr &mesh) -> bool
 Check if mesh is manifold.
 
template<class MeshPtr >
auto FindEdgePath (const MeshPtr &mesh, std::size_t from, std::size_t to)
 Find an edge path between two vertices.
 
template<typename MeshType >
auto PackCharts (std::vector< std::shared_ptr< MeshType > > &charts, const PackOptions< typename MeshType::type > &opts=PackOptions< typename MeshType::type >{}) -> PackResult< typename MeshType::PositionType >
 Pack a set of parameterized charts into a shared coordinate frame.
 
template<typename MeshType >
auto MergeMeshes (const std::vector< std::shared_ptr< MeshType > > &meshes) -> MergedMesh< MeshType >
 Merge several meshes into a single mesh.
 
template<class MeshType >
auto ReadMesh (const std::filesystem::path &path)
 Load a HalfEdgeMesh from a file.
 
template<class MeshPtr >
void WriteMesh (const std::filesystem::path &path, const MeshPtr &mesh)
 Write a HalfEdgeMesh to a file.
 

Variables

template<class T >
constexprPI = T(3.1415926535897932385L)
 Pi, templated for floating-point type.
 
template<class T >
constexpr T INF = std::numeric_limits<T>::infinity()
 Inf, templated for floating-point type.
 

Detailed Description

OpenABF top-level namespace

Enumeration Type Documentation

◆ Norm

Norm type enumeration.

Enumerator
L1 

$L_1$ norm

L2 

$L_2$ norm

LInf 

$L_{Inf}$ norm

Function Documentation

◆ ComputeFaceAngles()

template<class FacePtr >
void OpenABF::ComputeFaceAngles ( FacePtr &  face)
private

Compute the internal angles of a face.

Updates the current angle (DefaultEdgeTraits::alpha) with the internal angles derived from the face's vertex positions. Useful if you want to reset a face after being processed by ABF or ABFPlusPlus.

Template Parameters
FacePtrA Face-type pointer implementing DefaultEdgeTraits
Exceptions
MeshExceptionIf interior angle is NaN or Inf

◆ ComputeMeshAngles()

template<class MeshPtr >
void OpenABF::ComputeMeshAngles ( MeshPtr mesh)
private

Compute the internal angles for all faces in a mesh.

Runs ComputeFaceAngles on all faces in the mesh. Useful if you want to reset a mesh after running through ABF or ABFPlusPlus.

Template Parameters
MeshPtrA Mesh-type pointer with faces implementing DefaultEdgeTraits

◆ FindEdgePath()

template<class MeshPtr >
auto OpenABF::FindEdgePath ( const MeshPtr mesh,
std::size_t  from,
std::size_t  to 
)
private

Find an edge path between two vertices.

Uses Dijkstra's algorithm to find the shortest path between two vertices. Distance is measured using the edge lengths of the mesh. The returned mesh is not guaranteed to be the only shortest path (there may be many which have the same length), but only the first discovered.

If the returned list is empty, the endpoints are the same or a path between the two endpoints does not exist (i.e. the mesh has multiple connected components).

Returns
std::vector<EdgePtr>

◆ HasUnreferencedVertices()

template<class MeshPtr >
auto OpenABF::HasUnreferencedVertices ( const MeshPtr mesh) -> bool
private

Check if a mesh has unreferenced vertices.

Note
This only checks if the vertex is associated with at least one edge. A face is not currently guaranteed.

◆ MergeMeshes()

template<typename MeshType >
auto OpenABF::MergeMeshes ( const std::vector< std::shared_ptr< MeshType > > &  meshes) -> MergedMesh<MeshType>

Merge several meshes into a single mesh.

Concatenates the vertices and faces of each input mesh into one new mesh, offsetting face vertex indices per input so the inputs remain disjoint components. Returns the combined mesh alongside vertex_source/face_source maps that record, for every merged vertex and face, which input mesh and which source index it came from — the inverse of extract_connected_components, so the back-map chain survives the merge.

Vertex positions and vertex traits are preserved (via the vertex copy constructor). Edge and face traits are default-constructed: merge rebuilds connectivity, so per-edge/per-face solver state is not carried over.

Template Parameters
MeshTypeA HalfEdgeMesh specialization
Parameters
meshesMeshes to merge
Returns
The combined mesh and its provenance maps
Exceptions
std::invalid_argumentIf an input pointer is null or has no vertices.

◆ operator<<()

template<typename T , std::size_t Dims>
std::ostream & OpenABF::operator<< ( std::ostream &  os,
const Vec< T, Dims > &  vec 
)

Debug: Print a vector to a std::ostream

◆ PackCharts()

template<typename MeshType >
auto OpenABF::PackCharts ( std::vector< std::shared_ptr< MeshType > > &  charts,
const PackOptions< typename MeshType::type > &  opts = PackOptions<typename MeshType::type>{} 
) -> PackResult<typename MeshType::PositionType>
private

Pack a set of parameterized charts into a shared coordinate frame.

Lays out a list of already-parameterized charts (2D meshes whose vertex pos holds {u, v, ...}) into a single shared frame using shelf packing, so that no two charts' bounding boxes overlap. Operates purely on geometry: each chart's vertex positions are rotated (when minimize_bounding_box is set), translated, and (when normalize is set) uniformly scaled in place. Topology, vertex indices, and face indices are untouched, so any ExtractedComponent back-maps a caller holds remain valid after packing.

Scaling
By default charts keep their absolute scale and are only translated; the returned extent is meaningful in physical units. With opts.normalize, one global uniform scale maps the packed atlas into [0,1]^2.
Building a per-wedge UV map
This function does not own a UV-map type. To build a per-corner ("wedge") UV map from the packed charts, key each wedge by vertex identity, not by corner position: a face's corner order is not stable (the half-edge mesh may reverse a mis-wound face at insertion time, and that permutation is not recorded). Given an ExtractedComponent ec for a chart, the robust key is:
for (const auto& face : chart->faces()) {
for (const auto& edge : *face) { // walk the face's corners
auto origFace = ec.face_map[face->idx];
auto origVert = ec.vertex_map[edge->vertex->idx];
auto uv = edge->vertex->pos; // packed UV
// wedge (origFace, origVert) -> uv
}
}
constexpr T INF
Inf, templated for floating-point type.
Definition OpenABF.hpp:69
Complexity
O(n log n) in the number of charts n (dominated by the height sort) plus O(V) in the total vertex count V (two passes: one to measure bounding boxes, one to apply the transform). With minimize_bounding_box, each chart additionally costs an O(v log v) convex hull over its v vertices plus an O(h^2) orientation search, which measures the hull's h points once per hull edge. Memory overhead is O(n).
Template Parameters
MeshTypeA HalfEdgeMesh specialization
Parameters
chartsCharts to pack; each chart's vertex positions are modified
optsPacking options
Returns
The bounding box of the packed atlas
Exceptions
std::invalid_argumentIf a chart pointer is null, a chart has no vertices, opts.padding is negative, or opts.target_width is set to a non-positive value. All inputs are validated before any chart is modified, so a throw leaves every chart untouched.

◆ UnreferencedVertices()

template<class MeshPtr >
auto OpenABF::UnreferencedVertices ( const MeshPtr mesh) -> std::vector<std::size_t>
private

Get a list of unreferenced vertices.

Note
This only checks if the vertex is associated with at least one edge. A face is not currently guaranteed.