EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
EBGeometry::Parser Namespace Reference

Namespace which encapsulates possible file parsers for building EBGeometry data structures. More...

Classes

class  ParseError
 Thrown by the file readers, and by PolygonSoup::clean() and convertToDCEL(), when a file cannot be read into a mesh. More...
 

Enumerations

enum class  OnDefect { Throw , Warn }
 What a file reader does with a mesh whose faces do not form a clean, closed surface. More...
 
enum class  Encoding { ASCII , Binary , Unknown }
 Simple enum for separating ASCII and binary files. More...
 
enum class  FileType {
  STL , PLY , VTK , OBJ ,
  Unsupported
}
 Various supported file types. More...
 

Functions

static Parser::FileType getFileType (const std::string &a_filename)
 Determine file type from the file extension.
 
static Parser::Encoding getFileEncoding (const std::string &a_filename)
 Determine file encoding (ASCII or binary) by inspecting the file header.
 
template<typename T >
PolygonSoup< T > readPLY (const std::string &a_filename)
 Read a Stanford PLY file, ASCII or binary.
 
template<typename T >
std::vector< PolygonSoup< T > > readPLY (const std::vector< std::string > &a_filenames)
 Read several Stanford PLY files.
 
template<typename T >
PolygonSoup< T > readSTL (const std::string &a_filename)
 Read an STL file, ASCII or binary.
 
template<typename T >
std::vector< PolygonSoup< T > > readSTL (const std::vector< std::string > &a_filenames)
 Read several STL files.
 
template<typename T >
PolygonSoup< T > readOBJ (const std::string &a_filename)
 Read a Wavefront OBJ file.
 
template<typename T >
std::vector< PolygonSoup< T > > readOBJ (const std::vector< std::string > &a_filenames)
 Read several Wavefront OBJ files.
 
template<typename T >
PolygonSoup< T > readVTK (const std::string &a_filename)
 Read a legacy VTK POLYDATA file, ASCII or binary.
 
template<typename T >
std::vector< PolygonSoup< T > > readVTK (const std::vector< std::string > &a_filenames)
 Read several legacy VTK POLYDATA files.
 
template<typename T >
static PolygonSoup< T > readIntoPolygonSoup (const std::string &a_filename)
 Read a file of any supported format, chosen by its extension.
 
template<typename T >
static std::vector< PolygonSoup< T > > readIntoPolygonSoup (const std::vector< std::string > &a_files)
 Read several files of any supported format.
 
template<typename T >
static EBGeometry::DCEL::MeshT< T > readIntoDCEL (const std::string &a_filename, Pool &a_pool, const OnDefect a_onDefect=OnDefect::Throw)
 Read a file containing a single watertight object and return it as a DCEL mesh.
 
template<typename T >
static std::vector< EBGeometry::DCEL::MeshT< T > > readIntoDCEL (const std::vector< std::string > &a_files, Pool &a_pool, const OnDefect a_onDefect=OnDefect::Throw)
 Read several files, each containing a single watertight object, as DCEL meshes.
 
template<typename T >
static FlatMeshSDF< T > readIntoFlatMeshSDF (const std::string &a_filename, Pool &a_pool, const OnDefect a_onDefect=OnDefect::Throw)
 Read a file into a FlatMeshSDF: the signed distance to its DCEL mesh by a scan over every face, with no BVH.
 
template<typename T >
static std::vector< FlatMeshSDF< T > > readIntoFlatMeshSDF (const std::vector< std::string > &a_files, Pool &a_pool, const OnDefect a_onDefect=OnDefect::Throw)
 Read several files into FlatMeshSDFs.
 
template<typename T , size_t K = BVH::DefaultBranchingRatio<T>()>
static MeshSDF< T, K > readIntoMeshSDF (const std::string &a_filename, Pool &a_pool, const BVH::Construction a_construction=BVH::Construction::SAH, const OnDefect a_onDefect=OnDefect::Throw)
 Read a file into a MeshSDF: its DCEL mesh with a packed K-ary BVH over the faces.
 
template<typename T , size_t K = BVH::DefaultBranchingRatio<T>()>
static MeshSDF< T, K > readIntoMeshSDF (const std::string &a_filename, Pool &a_pool, const BVH::Construction a_construction, const BVH::ConstructionOptions &a_options, const OnDefect a_onDefect=OnDefect::Throw)
 Read a file into a MeshSDF, with leaf-size settings.
 
template<typename T , size_t K = BVH::DefaultBranchingRatio<T>()>
static std::vector< MeshSDF< T, K > > readIntoMeshSDF (const std::vector< std::string > &a_files, Pool &a_pool, const BVH::Construction a_construction=BVH::Construction::SAH, const OnDefect a_onDefect=OnDefect::Throw)
 Read several files into MeshSDFs.
 
template<typename T , size_t K = BVH::DefaultBranchingRatio<T>()>
static std::vector< MeshSDF< T, K > > readIntoMeshSDF (const std::vector< std::string > &a_files, Pool &a_pool, const BVH::Construction a_construction, const BVH::ConstructionOptions &a_options, const OnDefect a_onDefect=OnDefect::Throw)
 Read several files into MeshSDFs, with leaf-size settings.
 
template<typename T , size_t K = BVH::DefaultBranchingRatio<T>(), size_t W = TriangleSoA::DefaultWidth<T>()>
static TriMeshSDF< T, K, W > readIntoTriMeshSDF (const std::string &a_filename, Pool &a_pool, const BVH::Construction a_construction=BVH::Construction::SAH, const OnDefect a_onDefect=OnDefect::Throw)
 Read a file into a TriMeshSDF: its faces as triangles, in SIMD groups of W, under a packed K-ary BVH.
 
template<typename T , size_t K = BVH::DefaultBranchingRatio<T>(), size_t W = TriangleSoA::DefaultWidth<T>()>
static TriMeshSDF< T, K, W > readIntoTriMeshSDF (const std::string &a_filename, Pool &a_pool, const BVH::Construction a_construction, const BVH::ConstructionOptions &a_options, const OnDefect a_onDefect=OnDefect::Throw)
 Read a file into a TriMeshSDF, with leaf-size settings.
 
template<typename T , size_t K = BVH::DefaultBranchingRatio<T>(), size_t W = TriangleSoA::DefaultWidth<T>()>
static std::vector< TriMeshSDF< T, K, W > > readIntoTriMeshSDF (const std::vector< std::string > &a_files, Pool &a_pool, const BVH::Construction a_construction=BVH::Construction::SAH, const OnDefect a_onDefect=OnDefect::Throw)
 Read several files into TriMeshSDFs.
 
template<typename T , size_t K = BVH::DefaultBranchingRatio<T>(), size_t W = TriangleSoA::DefaultWidth<T>()>
static std::vector< TriMeshSDF< T, K, W > > readIntoTriMeshSDF (const std::vector< std::string > &a_files, Pool &a_pool, const BVH::Construction a_construction, const BVH::ConstructionOptions &a_options, const OnDefect a_onDefect=OnDefect::Throw)
 Read several files into TriMeshSDFs, with leaf-size settings.
 
template<typename T >
static std::vector< Triangle< T > > readIntoTriangles (const std::string &a_filename, const OnDefect a_onDefect=OnDefect::Throw)
 Read a file and return its faces as flat triangles.
 
template<typename T >
static std::vector< std::vector< Triangle< T > > > readIntoTriangles (const std::vector< std::string > &a_files, const OnDefect a_onDefect=OnDefect::Throw)
 Read several files and return each one's faces as flat triangles.
 

Detailed Description

Namespace which encapsulates possible file parsers for building EBGeometry data structures.

Enumeration Type Documentation

◆ Encoding

enum class EBGeometry::Parser::Encoding
strong

Simple enum for separating ASCII and binary files.

Enumerator
ASCII 

File is plain text.

Binary 

File is binary-encoded.

Unknown 

Encoding could not be determined.

◆ FileType

enum class EBGeometry::Parser::FileType
strong

Various supported file types.

Enumerator
STL 

Stereolithography format (.stl)

PLY 

Polygon File Format (.ply)

VTK 

Legacy VTK polydata format (.vtk)

OBJ 

Wavefront OBJ format (.obj)

Unsupported 

File type is not recognized.

◆ OnDefect

enum class EBGeometry::Parser::OnDefect
strong

What a file reader does with a mesh whose faces do not form a clean, closed surface.

Covers the defects a reader can survive: neighboring faces oriented inconsistently, an edge shared by three or more faces, and faces that fold back onto each other. Such a mesh loads and gives correct distances, but the sign of the distance near the defect is unreliable. Faults that would corrupt the half-edge mesh itself (an index out of range, a non-finite coordinate, a face that visits a vertex twice) always throw. Holes are never a defect.

Enumerator
Throw 

Throw a ParseError naming the defect. The default.

Warn 

Print a warning to std::cerr and load the mesh anyway.

Function Documentation

◆ getFileEncoding()

static Parser::Encoding EBGeometry::Parser::getFileEncoding ( const std::string &  a_filename)
inlinestatic

Determine file encoding (ASCII or binary) by inspecting the file header.

Parameters
[in]a_filenameFile name.
Returns
Detected Encoding (ASCII, Binary, or Unknown).

◆ getFileType()

static Parser::FileType EBGeometry::Parser::getFileType ( const std::string &  a_filename)
inlinestatic

Determine file type from the file extension.

Parameters
[in]a_filenameFile name.
Returns
Detected FileType (STL, PLY, VTK, OBJ, or Unsupported).

◆ readIntoDCEL() [1/2]

template<typename T >
static EBGeometry::DCEL::MeshT< T > EBGeometry::Parser::readIntoDCEL ( const std::string &  a_filename,
Pool &  a_pool,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read a file containing a single watertight object and return it as a DCEL mesh.

readIntoPolygonSoup() followed by PolygonSoup::convertToDCEL(). Face i of the mesh is face i of the soup: the file's i-th face, not counting degenerate faces, which are removed (see PolygonSoup::clean()). That index is the face id the mesh SDFs report from getClosestFace().

Template Parameters
TFloating-point precision for vertex coordinates.
Parameters
[in]a_filenameFile name (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve the mesh's vertex, edge and face storage from. The returned mesh resolves its storage through a_pool, so a_pool must outlive it.
[in]a_onDefectWhether faces oriented inconsistently, an edge shared by three or more faces, or faces that fold back onto each other throw (OnDefect::Throw, the default) or load with a warning (OnDefect::Warn); see OnDefect.
Returns
The DCEL mesh, by value.
Exceptions
ParseErrorif the file cannot be read, is malformed, or has no faces.

◆ readIntoDCEL() [2/2]

template<typename T >
static std::vector< EBGeometry::DCEL::MeshT< T > > EBGeometry::Parser::readIntoDCEL ( const std::vector< std::string > &  a_files,
Pool &  a_pool,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read several files, each containing a single watertight object, as DCEL meshes.

Template Parameters
TFloating-point precision for vertex coordinates.
Parameters
[in]a_filesFile names (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve every mesh's storage from; must outlive them.
[in]a_onDefectAs for the single-file overload.
Returns
One DCEL mesh per file.
Exceptions
ParseErrorif any of the files cannot be read, is malformed, or has no faces.

◆ readIntoFlatMeshSDF() [1/2]

template<typename T >
static FlatMeshSDF< T > EBGeometry::Parser::readIntoFlatMeshSDF ( const std::string &  a_filename,
Pool &  a_pool,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read a file into a FlatMeshSDF: the signed distance to its DCEL mesh by a scan over every face, with no BVH.

Template Parameters
TFloating-point precision.
Parameters
[in]a_filenameFile name (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve the mesh's storage from; must outlive the FlatMeshSDF.
[in]a_onDefectAs for readIntoDCEL().
Returns
The FlatMeshSDF, by value.
Exceptions
ParseErrorif the file cannot be read, is malformed, or has no faces.

◆ readIntoFlatMeshSDF() [2/2]

template<typename T >
static std::vector< FlatMeshSDF< T > > EBGeometry::Parser::readIntoFlatMeshSDF ( const std::vector< std::string > &  a_files,
Pool &  a_pool,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read several files into FlatMeshSDFs.

Template Parameters
TFloating-point precision.
Parameters
[in]a_filesFile names (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve every mesh's storage from; must outlive them.
[in]a_onDefectAs for readIntoDCEL().
Returns
One FlatMeshSDF per file.
Exceptions
ParseErrorif any of the files cannot be read, is malformed, or has no faces.

◆ readIntoMeshSDF() [1/4]

template<typename T , size_t K = BVH::DefaultBranchingRatio<T>()>
static MeshSDF< T, K > EBGeometry::Parser::readIntoMeshSDF ( const std::string &  a_filename,
Pool &  a_pool,
const BVH::Construction  a_construction,
const BVH::ConstructionOptions &  a_options,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read a file into a MeshSDF, with leaf-size settings.

Template Parameters
TFloating-point precision.
KBVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>().
Parameters
[in]a_filenameFile name (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve the mesh and its BVH from; must outlive the MeshSDF.
[in]a_constructionBVH construction method.
[in]a_optionsLeaf-size settings, in faces. The chosen method reads only its own field; start from MeshSDF::defaultConstructionOptions().
[in]a_onDefectAs for readIntoDCEL().
Returns
The MeshSDF, by value.
Exceptions
ParseErrorif the file cannot be read, is malformed, or has no faces.

◆ readIntoMeshSDF() [2/4]

template<typename T , size_t K = BVH::DefaultBranchingRatio<T>()>
static MeshSDF< T, K > EBGeometry::Parser::readIntoMeshSDF ( const std::string &  a_filename,
Pool &  a_pool,
const BVH::Construction  a_construction = BVH::Construction::SAH,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read a file into a MeshSDF: its DCEL mesh with a packed K-ary BVH over the faces.

Supports any polygon mesh. For a triangle mesh, readIntoTriMeshSDF() is usually faster to query. The leaf sizes are MeshSDF::defaultConstructionOptions().

Template Parameters
TFloating-point precision.
KBVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>().
Parameters
[in]a_filenameFile name (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve the mesh and its BVH from; must outlive the MeshSDF.
[in]a_constructionBVH construction method. SAH is the default and recommended choice.
[in]a_onDefectAs for readIntoDCEL().
Returns
The MeshSDF, by value.
Exceptions
ParseErrorif the file cannot be read, is malformed, or has no faces.

◆ readIntoMeshSDF() [3/4]

template<typename T , size_t K = BVH::DefaultBranchingRatio<T>()>
static std::vector< MeshSDF< T, K > > EBGeometry::Parser::readIntoMeshSDF ( const std::vector< std::string > &  a_files,
Pool &  a_pool,
const BVH::Construction  a_construction,
const BVH::ConstructionOptions &  a_options,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read several files into MeshSDFs, with leaf-size settings.

Template Parameters
TFloating-point precision.
KBVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>().
Parameters
[in]a_filesFile names (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve every mesh and BVH from; must outlive them.
[in]a_constructionBVH construction method.
[in]a_optionsLeaf-size settings, in faces.
[in]a_onDefectAs for readIntoDCEL().
Returns
One MeshSDF per file.
Exceptions
ParseErrorif any of the files cannot be read, is malformed, or has no faces.

◆ readIntoMeshSDF() [4/4]

template<typename T , size_t K = BVH::DefaultBranchingRatio<T>()>
static std::vector< MeshSDF< T, K > > EBGeometry::Parser::readIntoMeshSDF ( const std::vector< std::string > &  a_files,
Pool &  a_pool,
const BVH::Construction  a_construction = BVH::Construction::SAH,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read several files into MeshSDFs.

Template Parameters
TFloating-point precision.
KBVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>().
Parameters
[in]a_filesFile names (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve every mesh and BVH from; must outlive them.
[in]a_constructionBVH construction method.
[in]a_onDefectAs for readIntoDCEL().
Returns
One MeshSDF per file.
Exceptions
ParseErrorif any of the files cannot be read, is malformed, or has no faces.

◆ readIntoPolygonSoup() [1/2]

template<typename T >
static PolygonSoup< T > EBGeometry::Parser::readIntoPolygonSoup ( const std::string &  a_filename)
inlinestatic

Read a file of any supported format, chosen by its extension.

Template Parameters
TFloating-point precision for vertex coordinates and properties.
Parameters
[in]a_filenameFile name (.stl, .ply, .vtk or .obj).
Returns
The soup, cleaned (see PolygonSoup::clean()).
Exceptions
ParseErrorif the extension is not supported, or the file cannot be read or is malformed.

◆ readIntoPolygonSoup() [2/2]

template<typename T >
static std::vector< PolygonSoup< T > > EBGeometry::Parser::readIntoPolygonSoup ( const std::vector< std::string > &  a_files)
inlinestatic

Read several files of any supported format.

Template Parameters
TFloating-point precision for vertex coordinates and properties.
Parameters
[in]a_filesFile names (.stl, .ply, .vtk or .obj).
Returns
One cleaned soup per file.
Exceptions
ParseErrorif any of the files cannot be read.

◆ readIntoTriangles() [1/2]

template<typename T >
static std::vector< Triangle< T > > EBGeometry::Parser::readIntoTriangles ( const std::string &  a_filename,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read a file and return its faces as flat triangles.

readIntoPolygonSoup() followed by PolygonSoup::convertToTriangles(): each face becomes one or more Triangle objects with the mesh's vertex positions and normals, a polygon by a fan from one of its vertices (the one whose smallest fan triangle is largest). Each triangle carries the id of the face it was cut from, as readIntoDCEL() numbers the faces. The intermediate DCEL mesh lives in a Pool private to this call and is freed on return.

Template Parameters
TFloating-point precision.
Parameters
[in]a_filenameFile name (.stl, .ply, .vtk or .obj).
[in]a_onDefectAs for readIntoDCEL().
Returns
The triangles, by value.
Exceptions
ParseErrorif the file cannot be read, is malformed, or has no faces.

◆ readIntoTriangles() [2/2]

template<typename T >
static std::vector< std::vector< Triangle< T > > > EBGeometry::Parser::readIntoTriangles ( const std::vector< std::string > &  a_files,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read several files and return each one's faces as flat triangles.

Template Parameters
TFloating-point precision.
Parameters
[in]a_filesFile names (.stl, .ply, .vtk or .obj).
[in]a_onDefectAs for readIntoDCEL().
Returns
One triangle list per file.
Exceptions
ParseErrorif any of the files cannot be read, is malformed, or has no faces.

◆ readIntoTriMeshSDF() [1/4]

template<typename T , size_t K = BVH::DefaultBranchingRatio<T>(), size_t W = TriangleSoA::DefaultWidth<T>()>
static TriMeshSDF< T, K, W > EBGeometry::Parser::readIntoTriMeshSDF ( const std::string &  a_filename,
Pool &  a_pool,
const BVH::Construction  a_construction,
const BVH::ConstructionOptions &  a_options,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read a file into a TriMeshSDF, with leaf-size settings.

Template Parameters
TFloating-point precision.
KBVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>().
WTriangles per SIMD group. Defaults to TriangleSoA::DefaultWidth<T>().
Parameters
[in]a_filenameFile name (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve the BVH from; must outlive the TriMeshSDF.
[in]a_constructionBVH construction method.
[in]a_optionsLeaf-size settings, in triangles. The chosen method reads only its own field; start from TriMeshSDF::defaultConstructionOptions().
[in]a_onDefectAs for readIntoDCEL().
Returns
The TriMeshSDF, by value.
Exceptions
ParseErrorif the file cannot be read, is malformed, or has no faces.

◆ readIntoTriMeshSDF() [2/4]

template<typename T , size_t K = BVH::DefaultBranchingRatio<T>(), size_t W = TriangleSoA::DefaultWidth<T>()>
static TriMeshSDF< T, K, W > EBGeometry::Parser::readIntoTriMeshSDF ( const std::string &  a_filename,
Pool &  a_pool,
const BVH::Construction  a_construction = BVH::Construction::SAH,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read a file into a TriMeshSDF: its faces as triangles, in SIMD groups of W, under a packed K-ary BVH.

Polygon faces are fan-triangulated (see readIntoTriangles()). The DCEL mesh the triangles are cut from lives in a Pool private to this call, so it takes no space in a_pool. The leaf sizes are TriMeshSDF::defaultConstructionOptions(4): at most four groups of W triangles per leaf.

Template Parameters
TFloating-point precision.
KBVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>() (4, independent of compiler flags).
WTriangles per SIMD group. Defaults to TriangleSoA::DefaultWidth<T>().
Parameters
[in]a_filenameFile name (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve the BVH from; must outlive the TriMeshSDF.
[in]a_constructionBVH construction method. SAH is the default and recommended choice.
[in]a_onDefectAs for readIntoDCEL().
Returns
The TriMeshSDF, by value.
Exceptions
ParseErrorif the file cannot be read, is malformed, or has no faces.

◆ readIntoTriMeshSDF() [3/4]

template<typename T , size_t K = BVH::DefaultBranchingRatio<T>(), size_t W = TriangleSoA::DefaultWidth<T>()>
static std::vector< TriMeshSDF< T, K, W > > EBGeometry::Parser::readIntoTriMeshSDF ( const std::vector< std::string > &  a_files,
Pool &  a_pool,
const BVH::Construction  a_construction,
const BVH::ConstructionOptions &  a_options,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read several files into TriMeshSDFs, with leaf-size settings.

Template Parameters
TFloating-point precision.
KBVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>().
WTriangles per SIMD group. Defaults to TriangleSoA::DefaultWidth<T>().
Parameters
[in]a_filesFile names (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve every BVH from; must outlive them.
[in]a_constructionBVH construction method.
[in]a_optionsLeaf-size settings, in triangles.
[in]a_onDefectAs for readIntoDCEL().
Returns
One TriMeshSDF per file.
Exceptions
ParseErrorif any of the files cannot be read, is malformed, or has no faces.

◆ readIntoTriMeshSDF() [4/4]

template<typename T , size_t K = BVH::DefaultBranchingRatio<T>(), size_t W = TriangleSoA::DefaultWidth<T>()>
static std::vector< TriMeshSDF< T, K, W > > EBGeometry::Parser::readIntoTriMeshSDF ( const std::vector< std::string > &  a_files,
Pool &  a_pool,
const BVH::Construction  a_construction = BVH::Construction::SAH,
const OnDefect  a_onDefect = OnDefect::Throw 
)
inlinestatic

Read several files into TriMeshSDFs.

Template Parameters
TFloating-point precision.
KBVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>().
WTriangles per SIMD group. Defaults to TriangleSoA::DefaultWidth<T>().
Parameters
[in]a_filesFile names (.stl, .ply, .vtk or .obj).
[in,out]a_poolPool to reserve every BVH from; must outlive them.
[in]a_constructionBVH construction method.
[in]a_onDefectAs for readIntoDCEL().
Returns
One TriMeshSDF per file.
Exceptions
ParseErrorif any of the files cannot be read, is malformed, or has no faces.

◆ readOBJ() [1/2]

template<typename T >
PolygonSoup< T > EBGeometry::Parser::readOBJ ( const std::string &  a_filename)

Read a Wavefront OBJ file.

The vertices, the faces and the groups are read; texture coordinates, normals and materials are ignored. A face record with fewer than three vertices is not a face. A g or o line puts the faces after it in the face group of its name, until the next one (PolygonSoup::getFaceGroups()).

Template Parameters
TFloating-point precision for vertex coordinates.
Parameters
[in]a_filenameOBJ file name.
Returns
The soup, cleaned (see PolygonSoup::clean()).
Exceptions
ParseErrorif the file cannot be read or is malformed.

◆ readOBJ() [2/2]

template<typename T >
std::vector< PolygonSoup< T > > EBGeometry::Parser::readOBJ ( const std::vector< std::string > &  a_filenames)

Read several Wavefront OBJ files.

Template Parameters
TFloating-point precision for vertex coordinates.
Parameters
[in]a_filenamesOBJ file names.
Returns
One cleaned soup per file.
Exceptions
ParseErrorif any of the files cannot be read or is malformed.

◆ readPLY() [1/2]

template<typename T >
PolygonSoup< T > EBGeometry::Parser::readPLY ( const std::string &  a_filename)

Read a Stanford PLY file, ASCII or binary.

The scalar vertex properties other than x, y and z, and the scalar face properties, are kept as the soup's properties.

Template Parameters
TFloating-point precision for vertex coordinates and properties.
Parameters
[in]a_filenamePLY file name.
Returns
The soup, cleaned (see PolygonSoup::clean()).
Exceptions
ParseErrorif the file cannot be read or is malformed.

◆ readPLY() [2/2]

template<typename T >
std::vector< PolygonSoup< T > > EBGeometry::Parser::readPLY ( const std::vector< std::string > &  a_filenames)

Read several Stanford PLY files.

Template Parameters
TFloating-point precision for vertex coordinates and properties.
Parameters
[in]a_filenamesPLY file names.
Returns
One cleaned soup per file.
Exceptions
ParseErrorif any of the files cannot be read or is malformed.

◆ readSTL() [1/2]

template<typename T >
PolygonSoup< T > EBGeometry::Parser::readSTL ( const std::string &  a_filename)

Read an STL file, ASCII or binary.

The facet normals in the file are ignored. Every solid of an ASCII file is read, and each named solid's faces are a face group of that name (PolygonSoup::getFaceGroups()); a binary file has one solid and no groups.

Template Parameters
TFloating-point precision for vertex coordinates.
Parameters
[in]a_filenameSTL file name.
Returns
The soup, cleaned (see PolygonSoup::clean()).
Exceptions
ParseErrorif the file cannot be read or is malformed.

◆ readSTL() [2/2]

template<typename T >
std::vector< PolygonSoup< T > > EBGeometry::Parser::readSTL ( const std::vector< std::string > &  a_filenames)

Read several STL files.

Template Parameters
TFloating-point precision for vertex coordinates.
Parameters
[in]a_filenamesSTL file names.
Returns
One cleaned soup per file.
Exceptions
ParseErrorif any of the files cannot be read or is malformed.

◆ readVTK() [1/2]

template<typename T >
PolygonSoup< T > EBGeometry::Parser::readVTK ( const std::string &  a_filename)

Read a legacy VTK POLYDATA file, ASCII or binary.

The first component of each POINT_DATA and CELL_DATA scalar array is kept as a vertex or face property. An array with a different number of values than there are points or polygons (as when CELL_DATA also covers lines or vertices) is dropped with a warning.

Template Parameters
TFloating-point precision for vertex coordinates and properties.
Parameters
[in]a_filenameVTK file name.
Returns
The soup, cleaned (see PolygonSoup::clean()).
Exceptions
ParseErrorif the file cannot be read or is malformed.

◆ readVTK() [2/2]

template<typename T >
std::vector< PolygonSoup< T > > EBGeometry::Parser::readVTK ( const std::vector< std::string > &  a_filenames)

Read several legacy VTK POLYDATA files.

Template Parameters
TFloating-point precision for vertex coordinates and properties.
Parameters
[in]a_filenamesVTK file names.
Returns
One cleaned soup per file.
Exceptions
ParseErrorif any of the files cannot be read or is malformed.