|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
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. | |
Namespace which encapsulates possible file parsers for building EBGeometry data structures.
|
strong |
|
strong |
|
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. |
|
inlinestatic |
Determine file encoding (ASCII or binary) by inspecting the file header.
| [in] | a_filename | File name. |
|
inlinestatic |
Determine file type from the file extension.
| [in] | a_filename | File name. |
|
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().
| T | Floating-point precision for vertex coordinates. |
| [in] | a_filename | File name (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool 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_onDefect | Whether 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. |
| ParseError | if the file cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read several files, each containing a single watertight object, as DCEL meshes.
| T | Floating-point precision for vertex coordinates. |
| [in] | a_files | File names (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve every mesh's storage from; must outlive them. |
| [in] | a_onDefect | As for the single-file overload. |
| ParseError | if any of the files cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read a file into a FlatMeshSDF: the signed distance to its DCEL mesh by a scan over every face, with no BVH.
| T | Floating-point precision. |
| [in] | a_filename | File name (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve the mesh's storage from; must outlive the FlatMeshSDF. |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if the file cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read several files into FlatMeshSDFs.
| T | Floating-point precision. |
| [in] | a_files | File names (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve every mesh's storage from; must outlive them. |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if any of the files cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read a file into a MeshSDF, with leaf-size settings.
| T | Floating-point precision. |
| K | BVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>(). |
| [in] | a_filename | File name (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve the mesh and its BVH from; must outlive the MeshSDF. |
| [in] | a_construction | BVH construction method. |
| [in] | a_options | Leaf-size settings, in faces. The chosen method reads only its own field; start from MeshSDF::defaultConstructionOptions(). |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if the file cannot be read, is malformed, or has no faces. |
|
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().
| T | Floating-point precision. |
| K | BVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>(). |
| [in] | a_filename | File name (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve the mesh and its BVH from; must outlive the MeshSDF. |
| [in] | a_construction | BVH construction method. SAH is the default and recommended choice. |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if the file cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read several files into MeshSDFs, with leaf-size settings.
| T | Floating-point precision. |
| K | BVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>(). |
| [in] | a_files | File names (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve every mesh and BVH from; must outlive them. |
| [in] | a_construction | BVH construction method. |
| [in] | a_options | Leaf-size settings, in faces. |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if any of the files cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read several files into MeshSDFs.
| T | Floating-point precision. |
| K | BVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>(). |
| [in] | a_files | File names (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve every mesh and BVH from; must outlive them. |
| [in] | a_construction | BVH construction method. |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if any of the files cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read a file of any supported format, chosen by its extension.
| T | Floating-point precision for vertex coordinates and properties. |
| [in] | a_filename | File name (.stl, .ply, .vtk or .obj). |
| ParseError | if the extension is not supported, or the file cannot be read or is malformed. |
|
inlinestatic |
Read several files of any supported format.
| T | Floating-point precision for vertex coordinates and properties. |
| [in] | a_files | File names (.stl, .ply, .vtk or .obj). |
| ParseError | if any of the files cannot be read. |
|
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.
| T | Floating-point precision. |
| [in] | a_filename | File name (.stl, .ply, .vtk or .obj). |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if the file cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read several files and return each one's faces as flat triangles.
| T | Floating-point precision. |
| [in] | a_files | File names (.stl, .ply, .vtk or .obj). |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if any of the files cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read a file into a TriMeshSDF, with leaf-size settings.
| T | Floating-point precision. |
| K | BVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>(). |
| W | Triangles per SIMD group. Defaults to TriangleSoA::DefaultWidth<T>(). |
| [in] | a_filename | File name (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve the BVH from; must outlive the TriMeshSDF. |
| [in] | a_construction | BVH construction method. |
| [in] | a_options | Leaf-size settings, in triangles. The chosen method reads only its own field; start from TriMeshSDF::defaultConstructionOptions(). |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if the file cannot be read, is malformed, or has no faces. |
|
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.
| T | Floating-point precision. |
| K | BVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>() (4, independent of compiler flags). |
| W | Triangles per SIMD group. Defaults to TriangleSoA::DefaultWidth<T>(). |
| [in] | a_filename | File name (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve the BVH from; must outlive the TriMeshSDF. |
| [in] | a_construction | BVH construction method. SAH is the default and recommended choice. |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if the file cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read several files into TriMeshSDFs, with leaf-size settings.
| T | Floating-point precision. |
| K | BVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>(). |
| W | Triangles per SIMD group. Defaults to TriangleSoA::DefaultWidth<T>(). |
| [in] | a_files | File names (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve every BVH from; must outlive them. |
| [in] | a_construction | BVH construction method. |
| [in] | a_options | Leaf-size settings, in triangles. |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if any of the files cannot be read, is malformed, or has no faces. |
|
inlinestatic |
Read several files into TriMeshSDFs.
| T | Floating-point precision. |
| K | BVH branching factor. Defaults to BVH::DefaultBranchingRatio<T>(). |
| W | Triangles per SIMD group. Defaults to TriangleSoA::DefaultWidth<T>(). |
| [in] | a_files | File names (.stl, .ply, .vtk or .obj). |
| [in,out] | a_pool | Pool to reserve every BVH from; must outlive them. |
| [in] | a_construction | BVH construction method. |
| [in] | a_onDefect | As for readIntoDCEL(). |
| ParseError | if any of the files cannot be read, is malformed, or has no faces. |
| 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()).
| T | Floating-point precision for vertex coordinates. |
| [in] | a_filename | OBJ file name. |
| ParseError | if the file cannot be read or is malformed. |
| std::vector< PolygonSoup< T > > EBGeometry::Parser::readOBJ | ( | const std::vector< std::string > & | a_filenames | ) |
Read several Wavefront OBJ files.
| T | Floating-point precision for vertex coordinates. |
| [in] | a_filenames | OBJ file names. |
| ParseError | if any of the files cannot be read or is malformed. |
| 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.
| T | Floating-point precision for vertex coordinates and properties. |
| [in] | a_filename | PLY file name. |
| ParseError | if the file cannot be read or is malformed. |
| std::vector< PolygonSoup< T > > EBGeometry::Parser::readPLY | ( | const std::vector< std::string > & | a_filenames | ) |
Read several Stanford PLY files.
| T | Floating-point precision for vertex coordinates and properties. |
| [in] | a_filenames | PLY file names. |
| ParseError | if any of the files cannot be read or is malformed. |
| 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.
| T | Floating-point precision for vertex coordinates. |
| [in] | a_filename | STL file name. |
| ParseError | if the file cannot be read or is malformed. |
| std::vector< PolygonSoup< T > > EBGeometry::Parser::readSTL | ( | const std::vector< std::string > & | a_filenames | ) |
Read several STL files.
| T | Floating-point precision for vertex coordinates. |
| [in] | a_filenames | STL file names. |
| ParseError | if any of the files cannot be read or is malformed. |
| 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.
| T | Floating-point precision for vertex coordinates and properties. |
| [in] | a_filename | VTK file name. |
| ParseError | if the file cannot be read or is malformed. |
| std::vector< PolygonSoup< T > > EBGeometry::Parser::readVTK | ( | const std::vector< std::string > & | a_filenames | ) |
Read several legacy VTK POLYDATA files.
| T | Floating-point precision for vertex coordinates and properties. |
| [in] | a_filenames | VTK file names. |
| ParseError | if any of the files cannot be read or is malformed. |