EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_Soup.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
11#ifndef EBGEOMETRY_SOUP_HPP
12#define EBGEOMETRY_SOUP_HPP
13
14// Std includes
15#include <cstddef>
16#include <string>
17#include <vector>
18
19// Our includes
20#include "EBGeometry_DCEL.hpp"
21#include "EBGeometry_Pool.hpp"
22#include "EBGeometry_Vec.hpp"
23
24namespace EBGeometry {
25
29namespace Soup {
39template <typename T>
40[[nodiscard]] inline static bool
41containsDegeneratePolygons(const std::vector<EBGeometry::Vec3T<T>>& a_vertices,
42 const std::vector<std::vector<size_t>>& a_facets);
43
55template <typename T>
56[[nodiscard]] inline static bool
57isValid(const std::vector<EBGeometry::Vec3T<T>>& a_vertices,
58 const std::vector<std::vector<size_t>>& a_facets,
59 std::string& a_reason);
60
71template <typename T>
72inline static std::vector<size_t>
73compress(std::vector<EBGeometry::Vec3T<T>>& a_vertices, std::vector<std::vector<size_t>>& a_facets);
74
86template <typename T>
87[[nodiscard]] inline static bool
88isZeroArea(const std::vector<EBGeometry::Vec3T<T>>& a_vertices, const std::vector<size_t>& a_facet) noexcept;
89
111template <typename T>
112inline static std::vector<size_t>
113removeDegeneratePolygons(const std::vector<EBGeometry::Vec3T<T>>& a_vertices,
114 std::vector<std::vector<size_t>>& a_facets);
115
124[[nodiscard]] inline static std::string
125findRepeatedVertex(const std::vector<std::vector<size_t>>& a_facets);
126
139[[nodiscard]] inline static std::string
140findTopologyDefect(const std::vector<std::vector<size_t>>& a_facets);
141
151template <typename T>
152[[nodiscard]] inline static std::string
154
171template <typename T>
172inline static void
174 Pool& a_pool,
175 const std::vector<EBGeometry::Vec3T<T>>& a_vertices,
176 const std::vector<std::vector<size_t>>& a_facets,
177 const std::string& a_id);
178
191template <typename T>
192inline static void
194
195} // namespace Soup
196
197} // namespace EBGeometry
198
199#include "EBGeometry_SoupImplem.hpp"
200
201#endif
Namespace documentation.
Growable bump arena for the GPU memory foundation.
Declaration of 2D and 3D point/vector classes with templated precision, and free functions on them.
DCEL mesh class - stores a doubly-connected edge mesh.
Definition EBGeometry_DCEL_Mesh.hpp:102
Growable bump arena over a MemoryResource.
Definition EBGeometry_Pool.hpp:205
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:258
static void reconcilePairEdgesDCEL(EBGeometry::DCEL::MeshT< T > &a_mesh)
Reconcile pair edges: link each half-edge with its reverse.
static std::string findFoldedFeature(const EBGeometry::DCEL::MeshT< T > &a_mesh)
Find an edge or vertex of a half-edge mesh whose pseudonormal is zero.
static void soupToDCEL(EBGeometry::DCEL::MeshT< T > &a_mesh, Pool &a_pool, const std::vector< EBGeometry::Vec3T< T > > &a_vertices, const std::vector< std::vector< size_t > > &a_facets, const std::string &a_id)
Convert a polygon soup into a DCEL half-edge mesh.
static bool isValid(const std::vector< EBGeometry::Vec3T< T > > &a_vertices, const std::vector< std::vector< size_t > > &a_facets, std::string &a_reason)
Check that a polygon soup can describe a mesh at all.
static bool containsDegeneratePolygons(const std::vector< EBGeometry::Vec3T< T > > &a_vertices, const std::vector< std::vector< size_t > > &a_facets)
Check if a polygon soup contains degenerate polygons.
static std::string findRepeatedVertex(const std::vector< std::vector< size_t > > &a_facets)
Find a polygon that visits a vertex twice.
static std::vector< size_t > removeDegeneratePolygons(const std::vector< EBGeometry::Vec3T< T > > &a_vertices, std::vector< std::vector< size_t > > &a_facets)
Remove degenerate polygons from a compressed polygon soup, repairing the mesh around them.
static bool isZeroArea(const std::vector< EBGeometry::Vec3T< T > > &a_vertices, const std::vector< size_t > &a_facet) noexcept
Whether a polygon has zero area to within rounding.
static std::string findTopologyDefect(const std::vector< std::vector< size_t > > &a_facets)
Find a defect that stops a compressed, cleaned polygon soup from forming a half-edge mesh.
static std::vector< size_t > compress(std::vector< EBGeometry::Vec3T< T > > &a_vertices, std::vector< std::vector< size_t > > &a_facets)
Compress a polygon soup by removing duplicate vertices.
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26