13#ifndef EBGeometry_Parser
14#define EBGeometry_Parser
58 template <
typename T,
typename Meta = DCEL::DefaultMetaData>
59 inline static std::shared_ptr<EBGeometry::DCEL::MeshT<T, Meta>>
60 readIntoDCEL(
const std::string
a_filename)
noexcept;
66 template <
typename T,
typename Meta = DCEL::DefaultMetaData>
67 inline static std::vector<std::shared_ptr<EBGeometry::DCEL::MeshT<T, Meta>>>
68 readIntoDCEL(
const std::vector<std::string>
a_files)
noexcept;
74 template <
typename T,
typename Meta = DCEL::DefaultMetaData>
75 inline static std::shared_ptr<MeshSDF<T, Meta>>
76 readIntoMesh(
const std::string
a_filename)
noexcept;
82 template <
typename T,
typename Meta = DCEL::DefaultMetaData>
83 inline static std::vector<std::shared_ptr<MeshSDF<T, Meta>>>
84 readIntoMesh(
const std::vector<std::string>
a_files)
noexcept;
92 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
94 inline static std::shared_ptr<FastMeshSDF<T, Meta, BV, K>>
95 readIntoFullBVH(
const std::string
a_filename)
noexcept;
101 template <
typename T,
103 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
105 inline static std::vector<std::shared_ptr<FastMeshSDF<T, Meta, BV, K>>>
106 readIntoFullBVH(
const std::vector<std::string>
a_files)
noexcept;
112 template <
typename T,
114 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
116 inline static std::shared_ptr<FastCompactMeshSDF<T, Meta, BV, K>>
117 readIntoLinearBVH(
const std::string
a_filename)
noexcept;
123 template <
typename T,
125 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
127 inline static std::vector<std::shared_ptr<FastCompactMeshSDF<T, Meta, BV, K>>>
128 readIntoLinearBVH(
const std::vector<std::string>
a_files)
noexcept;
134 template <
typename T,
typename Meta,
typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
size_t K = 4>
135 inline static std::shared_ptr<FastTriMeshSDF<T, Meta, BV, K>>
136 readIntoTriangleBVH(
const std::string
a_filename)
noexcept;
142 template <
typename T,
144 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
146 inline static std::vector<std::shared_ptr<FastMeshSDF<T, Meta, BV, K>>>
147 readIntoTriangleBVH(
const std::vector<std::string>
a_files)
noexcept;
153 template <
typename T,
typename Meta>
154 inline static std::vector<std::shared_ptr<Triangle<T, Meta>>>
155 readIntoTriangles(
const std::string
a_filename)
noexcept;
161 template <
typename T,
typename Meta>
162 inline static std::vector<std::vector<std::shared_ptr<Triangle<T, Meta>>>>
163 readIntoTriangles(
const std::vector<std::string>
a_files)
noexcept;
170 getFileType(
const std::string
a_filename)
noexcept;
177 template <
typename T>
179 containsDegeneratePolygons(
const std::vector<EBGeometry::Vec3T<T>>&
a_vertices,
180 const std::vector<std::vector<size_t>>&
a_facets)
noexcept;
187 template <
typename T>
189 compress(std::vector<EBGeometry::Vec3T<T>>&
a_vertices, std::vector<std::vector<size_t>>&
a_facets)
noexcept;
197 template <
typename T,
typename Meta>
199 soupToDCEL(EBGeometry::DCEL::MeshT<T, Meta>&
a_mesh,
200 const std::vector<EBGeometry::Vec3T<T>>&
a_vertices,
201 const std::vector<std::vector<size_t>>&
a_facets)
noexcept;
208 template <
typename T,
typename Meta>
210 reconcilePairEdgesDCEL(std::vector<std::shared_ptr<EBGeometry::DCEL::EdgeT<T, Meta>>>&
a_edges)
noexcept;
216 template <
typename T,
typename Meta>
223 using Vec3 = EBGeometry::Vec3T<T>;
228 using Vertex = EBGeometry::DCEL::VertexT<T, Meta>;
233 using Edge = EBGeometry::DCEL::EdgeT<T, Meta>;
238 using Face = EBGeometry::DCEL::FaceT<T, Meta>;
243 using Mesh = EBGeometry::DCEL::MeshT<T, Meta>;
255 inline static std::shared_ptr<Mesh>
262 inline static std::vector<std::pair<std::shared_ptr<Mesh>, std::string>>
278 inline static std::vector<std::pair<std::shared_ptr<Mesh>, std::string>>
285 inline static std::vector<std::pair<std::shared_ptr<Mesh>, std::string>>
299 std::vector<std::vector<size_t>>&
a_facets,
310 template <
typename T>
317 using Vec3 = EBGeometry::Vec3T<T>;
322 using Vertex = EBGeometry::DCEL::VertexT<T>;
327 using Edge = EBGeometry::DCEL::EdgeT<T>;
332 using Face = EBGeometry::DCEL::FaceT<T>;
337 using Mesh = EBGeometry::DCEL::MeshT<T>;
349 inline static std::shared_ptr<Mesh>
370 std::vector<std::vector<size_t>>&
a_faces,
382 std::vector<std::vector<size_t>>&
a_faces,
389#include "EBGeometry_ParserImplem.hpp"
Declaration of a various bounding volumes used for bounding volume hierarchy.
Declaration of a mesh class which stores a DCEL mesh (with signed distance functions)
Declaration of signed distance functions for DCEL meshes.
Declaration of a triangle class with signed distance functionality.
Class for reading Stanford PLY files.
Definition EBGeometry_Parser.hpp:312
static Encoding getEncoding(const std::string a_filename) noexcept
Check if the input PLY file is an ASCII file or a binary.
EBGeometry::DCEL::MeshT< T > Mesh
Alias for mesh type.
Definition EBGeometry_Parser.hpp:337
static void readPLYSoupBinary(std::vector< Vec3 > &a_vertices, std::vector< std::vector< size_t > > &a_faces, std::ifstream &a_fileStream) noexcept
Read a binary PLY file into a triangle soup.
EBGeometry::DCEL::FaceT< T > Face
Alias for face type.
Definition EBGeometry_Parser.hpp:332
EBGeometry::DCEL::EdgeT< T > Edge
Alias for edge type.
Definition EBGeometry_Parser.hpp:327
static std::shared_ptr< Mesh > read(const std::string a_filename) noexcept
Static function which reads an ASCII .ply file and returns a DCEL mesh.
EBGeometry::DCEL::VertexT< T > Vertex
Alias for vertex type.
Definition EBGeometry_Parser.hpp:322
EBGeometry::DCEL::EdgeIteratorT< T > EdgeIterator
Alias for edge iterator type.
Definition EBGeometry_Parser.hpp:342
static void readPLYSoupASCII(std::vector< Vec3 > &a_vertices, std::vector< std::vector< size_t > > &a_faces, std::ifstream &a_fileStream) noexcept
Read an ASCII PLY file into a triangle soup.
EBGeometry::Vec3T< T > Vec3
Alias for vector type.
Definition EBGeometry_Parser.hpp:317
Class for reading STL files.
Definition EBGeometry_Parser.hpp:218
EBGeometry::DCEL::EdgeT< T, Meta > Edge
Alias for edge type.
Definition EBGeometry_Parser.hpp:233
static std::vector< std::pair< std::shared_ptr< Mesh >, std::string > > readBinary(const std::string a_filename) noexcept
Binary reader for STL files, possibly containing multiple objects. Each object becomes a DCEL mesh.
EBGeometry::Vec3T< T > Vec3
Alias for vector type.
Definition EBGeometry_Parser.hpp:223
EBGeometry::DCEL::FaceT< T, Meta > Face
Alias for face type.
Definition EBGeometry_Parser.hpp:238
static void readSTLSoupASCII(std::vector< Vec3 > &a_vertices, std::vector< std::vector< size_t > > &a_facets, std::string &a_objectName, const std::vector< std::string > &a_fileContents, const size_t a_firstLine, const size_t a_lastLine) noexcept
Read an STL object as a triangle soup into a raw vertices and facets.
EBGeometry::DCEL::MeshT< T, Meta > Mesh
Alias for mesh type.
Definition EBGeometry_Parser.hpp:243
static std::shared_ptr< Mesh > readSingle(const std::string a_filename) noexcept
Read a single STL object from the input file. The file can be binary or ASCII. If the STL file contai...
EBGeometry::DCEL::EdgeIteratorT< T, Meta > EdgeIterator
Alias for edge iterator type.
Definition EBGeometry_Parser.hpp:248
static std::vector< std::pair< std::shared_ptr< Mesh >, std::string > > readMulti(const std::string a_filename) noexcept
Read a single STL object from the input file. The file can be binary or ASCII.
static Encoding getEncoding(const std::string a_filename) noexcept
Check if the input STL file is an ASCII file or a binary.
static std::vector< std::pair< std::shared_ptr< Mesh >, std::string > > readASCII(const std::string a_filename) noexcept
ASCII reader STL files, possibly containing multiple objects. Each object becomes a DCEL mesh.
EBGeometry::DCEL::VertexT< T, Meta > Vertex
Alias for vertex type.
Definition EBGeometry_Parser.hpp:228
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:218
short DefaultMetaData
Default meta-data type for the DCEL primitives.
Definition EBGeometry_DCEL.hpp:27
Namespace which encapsulates possible file parsers for building EBGeometry data structures.
Definition EBGeometry_Parser.hpp:32
Encoding
Simple enum for separating ASCII and binary files.
Definition EBGeometry_Parser.hpp:38
FileType
Various supported file types.
Definition EBGeometry_Parser.hpp:48