|
|
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.
|
| |
OpenABF top-level namespace
| 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>
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
-
- Parameters
-
- Returns
- The combined mesh and its provenance maps
- Exceptions
-
| std::invalid_argument | If an input pointer is null or has no vertices. |
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) {
auto uv = edge->vertex->pos;
}
}
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
-
- Parameters
-
| charts | Charts to pack; each chart's vertex positions are modified |
| opts | Packing options |
- Returns
- The bounding box of the packed atlas
- Exceptions
-
| std::invalid_argument | If 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. |