13 #ifndef EBGeometry_Parser
14 #define EBGeometry_Parser
57 template <
typename T,
typename Meta = DCEL::DefaultMetaData>
58 inline static std::shared_ptr<EBGeometry::DCEL::MeshT<T, Meta>>
59 readIntoDCEL(
const std::string a_filename) noexcept;
65 template <
typename T,
typename Meta = DCEL::DefaultMetaData>
66 inline static std::vector<std::shared_ptr<EBGeometry::DCEL::MeshT<T, Meta>>>
67 readIntoDCEL(
const std::vector<std::string> a_files) noexcept;
73 template <
typename T,
typename Meta = DCEL::DefaultMetaData>
74 inline static std::shared_ptr<MeshSDF<T, Meta>>
75 readIntoMesh(
const std::string a_filename) noexcept;
81 template <
typename T,
typename Meta = DCEL::DefaultMetaData>
82 inline static std::vector<std::shared_ptr<MeshSDF<T, Meta>>>
83 readIntoMesh(
const std::vector<std::string> a_files) noexcept;
91 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
93 inline static std::shared_ptr<FastMeshSDF<T, Meta, BV, K>>
94 readIntoFullBVH(
const std::string a_filename) noexcept;
100 template <
typename T,
102 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
104 inline static std::vector<std::shared_ptr<FastMeshSDF<T, Meta, BV, K>>>
105 readIntoFullBVH(
const std::vector<std::string> a_files) noexcept;
111 template <
typename T,
113 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
115 inline static std::shared_ptr<FastCompactMeshSDF<T, Meta, BV, K>>
116 readIntoLinearBVH(
const std::string a_filename) noexcept;
122 template <
typename T,
124 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
126 inline static std::vector<std::shared_ptr<FastCompactMeshSDF<T, Meta, BV, K>>>
127 readIntoLinearBVH(
const std::vector<std::string> a_files) noexcept;
134 getFileType(
const std::string a_filename) noexcept;
141 template <
typename T>
143 containsDegeneratePolygons(
const std::vector<EBGeometry::Vec3T<T>>& a_vertices,
144 const std::vector<std::vector<size_t>>& a_facets) noexcept;
151 template <
typename T>
153 compress(std::vector<EBGeometry::Vec3T<T>>& a_vertices, std::vector<std::vector<size_t>>& a_facets) noexcept;
161 template <
typename T,
typename Meta>
163 soupToDCEL(EBGeometry::DCEL::MeshT<T, Meta>& a_mesh,
164 const std::vector<EBGeometry::Vec3T<T>>& a_vertices,
165 const std::vector<std::vector<size_t>>& a_facets) noexcept;
172 template <
typename T,
typename Meta>
174 reconcilePairEdgesDCEL(std::vector<std::shared_ptr<EBGeometry::DCEL::EdgeT<T, Meta>>>& a_edges) noexcept;
180 template <
typename T,
typename Meta>
187 using Vec3 = EBGeometry::Vec3T<T>;
192 using Vertex = EBGeometry::DCEL::VertexT<T, Meta>;
197 using Edge = EBGeometry::DCEL::EdgeT<T, Meta>;
202 using Face = EBGeometry::DCEL::FaceT<T, Meta>;
207 using Mesh = EBGeometry::DCEL::MeshT<T, Meta>;
219 inline static std::shared_ptr<Mesh>
226 inline static std::vector<std::pair<std::shared_ptr<Mesh>, std::string>>
242 inline static std::vector<std::pair<std::shared_ptr<Mesh>, std::string>>
249 inline static std::vector<std::pair<std::shared_ptr<Mesh>, std::string>>
263 std::vector<std::vector<size_t>>& a_facets,
264 std::string& a_objectName,
265 const std::vector<std::string>& a_fileContents,
266 const size_t a_firstLine,
267 const size_t a_lastLine) noexcept;
274 template <
typename T>
281 using Vec3 = EBGeometry::Vec3T<T>;
286 using Vertex = EBGeometry::DCEL::VertexT<T>;
291 using Edge = EBGeometry::DCEL::EdgeT<T>;
296 using Face = EBGeometry::DCEL::FaceT<T>;
301 using Mesh = EBGeometry::DCEL::MeshT<T>;
313 inline static std::shared_ptr<Mesh>
314 read(
const std::string a_filename) noexcept;
334 std::vector<std::vector<size_t>>& a_faces,
335 std::ifstream& a_fileStream) noexcept;
346 std::vector<std::vector<size_t>>& a_faces,
347 std::ifstream& a_fileStream) noexcept;
353 #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.
Class for reading Stanford PLY files.
Definition: EBGeometry_Parser.hpp:276
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.
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:301
EBGeometry::DCEL::FaceT< T > Face
Alias for face type.
Definition: EBGeometry_Parser.hpp:296
EBGeometry::DCEL::EdgeT< T > Edge
Alias for edge type.
Definition: EBGeometry_Parser.hpp:291
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::DCEL::VertexT< T > Vertex
Alias for vertex type.
Definition: EBGeometry_Parser.hpp:286
EBGeometry::DCEL::EdgeIteratorT< T > EdgeIterator
Alias for edge iterator type.
Definition: EBGeometry_Parser.hpp:306
EBGeometry::Vec3T< T > Vec3
Alias for vector type.
Definition: EBGeometry_Parser.hpp:281
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.
Class for reading STL files.
Definition: EBGeometry_Parser.hpp:182
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.
EBGeometry::DCEL::EdgeT< T, Meta > Edge
Alias for edge type.
Definition: EBGeometry_Parser.hpp:197
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:187
EBGeometry::DCEL::FaceT< T, Meta > Face
Alias for face type.
Definition: EBGeometry_Parser.hpp:202
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::MeshT< T, Meta > Mesh
Alias for mesh type.
Definition: EBGeometry_Parser.hpp:207
EBGeometry::DCEL::EdgeIteratorT< T, Meta > EdgeIterator
Alias for edge iterator type.
Definition: EBGeometry_Parser.hpp:212
static Encoding getEncoding(const std::string a_filename) noexcept
Check if the input STL file is an ASCII file or a binary.
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::VertexT< T, Meta > Vertex
Alias for vertex type.
Definition: EBGeometry_Parser.hpp:192
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.
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:31
Encoding
Simple enum for separating ASCII and binary files.
Definition: EBGeometry_Parser.hpp:37
FileType
Various supported file types.
Definition: EBGeometry_Parser.hpp:47