11#ifndef EBGEOMETRY_POLYGONSOUP_HPP
12#define EBGEOMETRY_POLYGONSOUP_HPP
48 static_assert(std::is_floating_point_v<T>,
"PolygonSoup<T>: T must be a floating-point type");
75 PolygonSoup(std::string a_id, std::vector<Vec3> a_vertices, std::vector<std::vector<size_t>> a_facets)
noexcept;
81 [[nodiscard]]
const std::string&
88 [[nodiscard]] const std::vector<
Vec3>&
95 [[nodiscard]] const std::vector<std::vector<
size_t>>&
134 [[nodiscard]] const std::vector<T>&
143 [[nodiscard]] const std::vector<T>&
150 [[nodiscard]] std::vector<std::
string>
157 [[nodiscard]] std::vector<std::
string>
217 [[nodiscard]] DCEL::MeshT<T>
230 [[nodiscard]] std::vector<
Triangle<T>>
269#include "EBGeometry_PolygonSoupImplem.hpp"
Declaration of a mesh class which stores a DCEL mesh (with signed distance functions)
Declaration of the exception the file readers throw.
Growable bump arena for the GPU memory foundation.
Declaration of a triangle class with signed distance functionality.
Declaration of 2D and 3D point/vector classes with templated precision, and free functions on them.
Polygons as a file stores them: vertex coordinates, faces as lists of vertex indices,...
Definition EBGeometry_PolygonSoup.hpp:47
bool m_isClean
Whether clean() has run.
Definition EBGeometry_PolygonSoup.hpp:264
void setVertexProperty(const std::string &a_name, std::vector< T > a_data)
Add or replace a vertex property.
const std::string & getID() const noexcept
Get the identifier.
std::map< std::string, std::vector< T > > m_vertexProperties
Vertex properties, one value per vertex.
Definition EBGeometry_PolygonSoup.hpp:252
void setFaceProperty(const std::string &a_name, std::vector< T > a_data)
Add or replace a face property.
const std::vector< Vec3 > & getVertexCoordinates() const noexcept
Get the vertex coordinates.
size_t clean()
Merge duplicate vertices and remove degenerate faces, carrying the properties along.
std::vector< Vec3 > m_vertexCoordinates
Vertex coordinates.
Definition EBGeometry_PolygonSoup.hpp:242
bool hasVertexProperty(const std::string &a_name) const noexcept
Whether a vertex property exists.
std::vector< std::string > getVertexPropertyNames() const
Names of the vertex properties.
std::string m_id
Identifier, usually the file name.
Definition EBGeometry_PolygonSoup.hpp:237
DCEL::MeshT< T > convertToDCEL(Pool &a_pool, Parser::OnDefect a_onDefect=Parser::OnDefect::Throw) const
Build a DCEL mesh from the soup.
std::vector< std::vector< size_t > > m_facets
Faces, each a list of indices into m_vertexCoordinates.
Definition EBGeometry_PolygonSoup.hpp:247
const std::vector< std::vector< size_t > > & getFacets() const noexcept
Get the faces.
PolygonSoup(std::string a_id, std::vector< Vec3 > a_vertices, std::vector< std::vector< size_t > > a_facets) noexcept
Constructor from vertex coordinates and faces, as read.
bool isClean() const noexcept
Whether the soup is clean: clean() has run, and nothing has changed the geometry since.
size_t numFacets() const noexcept
Number of faces.
std::vector< Triangle< T > > convertToTriangles(Parser::OnDefect a_onDefect=Parser::OnDefect::Throw) const
Build flat triangles from the soup.
std::vector< std::string > getFacePropertyNames() const
Names of the face properties.
PolygonSoup()=default
Default constructor. An empty soup with an empty identifier.
PolygonSoup(std::string a_id) noexcept
Constructor. An empty soup with an identifier.
std::map< std::string, std::vector< T > > m_faceProperties
Face properties, one value per face.
Definition EBGeometry_PolygonSoup.hpp:257
const std::vector< T > & getFaceProperty(const std::string &a_name) const
Get a face property.
size_t numVertices() const noexcept
Number of vertices.
const std::vector< T > & getVertexProperty(const std::string &a_name) const
Get a vertex property.
bool hasFaceProperty(const std::string &a_name) const noexcept
Whether a face property exists.
Growable bump arena over a MemoryResource.
Definition EBGeometry_Pool.hpp:183
Triangle class with signed distance functionality.
Definition EBGeometry_Triangle.hpp:52
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:258
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26