ug4
|
Namespaces | |
stl_reader_impl | |
Classes | |
class | StlMesh |
convenience mesh class which makes accessing the stl data more easy More... | |
Functions | |
template<class TNumberContainer , class TIndexContainer > | |
bool | ReadStlFile (const char *filename, TNumberContainer &coordsOut, TNumberContainer &normalsOut, TIndexContainer &trisOut, TIndexContainer &solidRangesOut) |
Reads an ASCII or binary stl file into several arrays. More... | |
template<class TNumberContainer , class TIndexContainer > | |
bool | ReadStlFile_ASCII (const char *filename, TNumberContainer &coordsOut, TNumberContainer &normalsOut, TIndexContainer &trisOut, TIndexContainer &solidRangesOut) |
Reads an ASCII stl file into several arrays. More... | |
template<class TNumberContainer , class TIndexContainer > | |
bool | ReadStlFile_BINARY (const char *filename, TNumberContainer &coordsOut, TNumberContainer &normalsOut, TIndexContainer &trisOut, TIndexContainer &solidRangesOut) |
Reads a binary stl file into several arrays. More... | |
bool | StlFileHasASCIIFormat (const char *filename) |
Determines whether a stl file has ASCII format. More... | |
bool stl_reader::ReadStlFile | ( | const char * | filename, |
TNumberContainer & | coordsOut, | ||
TNumberContainer & | normalsOut, | ||
TIndexContainer & | trisOut, | ||
TIndexContainer & | solidRangesOut | ||
) |
Reads an ASCII or binary stl file into several arrays.
Reads a stl file and writes its coordinates, normals and triangle-corner-indices to the provided containers. It also fills a container solidRangesOut, which provides the triangle ranges for individual solids.
Double vertex entries are removed on the fly, so that triangle corners with equal coordinates are represented by a single coordinate entry in coordsOut.
filename | [in] The name of the file which shall be read |
coordsOut | [out] Coordinates are written to this container. On termination, it has size numVertices * 3. Each triple of entries forms a 3d coordinate. The type TNumberContainer should have the same interface as std::vector<float>. |
normalsOut | [out] Face normals are written to this container. On termination, it has size numFaces * 3. Each triple of entries forms a 3d normal. The type TNumberContainer should have the same interface as std::vector<float>. |
trisOut | [out] Triangle corner indices are written to this container. On termination, it has size numFaces * 3. Each triple of entries defines a triangle. The type TIndexContainer should have the same interface as std::vector<size_t>. Multiply corner indices from trisOut by 3 to obtain the index of the first coordinate of that corner in coordsOut. |
solidRangesOut | [out] On termination, it holds the ranges of triangle indices for each solid. It has the size numSolids + 1. Each entry can be interpreted as a end/begin triangle index for the previous/next solid. E.g., if there are 3 solids, the returned array would look like this: {sol1Begin, sol1End/sol2Begin, sol2End/sol3Begin, sol3End}.
|
References ReadStlFile_ASCII(), ReadStlFile_BINARY(), and StlFileHasASCIIFormat().
Referenced by ug::LoadGridFromSTL(), and stl_reader::StlMesh< TNumber, TIndex >::read_file().
bool stl_reader::ReadStlFile_ASCII | ( | const char * | filename, |
TNumberContainer & | coordsOut, | ||
TNumberContainer & | normalsOut, | ||
TIndexContainer & | trisOut, | ||
TIndexContainer & | solidRangesOut | ||
) |
Reads an ASCII stl file into several arrays.
Reads a stl file and writes its coordinates, normals and triangle-corner-indices to the provided containers. It also fills a container solidRangesOut, which provides the triangle ranges for individual solids.
Double vertex entries are removed on the fly, so that triangle corners with equal coordinates are represented by a single coordinate entry in coordsOut.
filename | [in] The name of the file which shall be read |
coordsOut | [out] Coordinates are written to this container. On termination, it has size numVertices * 3. Each triple of entries forms a 3d coordinate. The type TNumberContainer should have the same interface as std::vector<float>. |
normalsOut | [out] Face normals are written to this container. On termination, it has size numFaces * 3. Each triple of entries forms a 3d normal. The type TNumberContainer should have the same interface as std::vector<float>. |
trisOut | [out] Triangle corner indices are written to this container. On termination, it has size numFaces * 3. Each triple of entries defines a triangle. The type TIndexContainer should have the same interface as std::vector<size_t>. Multiply corner indices from trisOut by 3 to obtain the index of the first coordinate of that corner in coordsOut. |
solidRangesOut | [out] On termination, it holds the ranges of triangle indices for each solid. It has the size numSolids + 1. Each entry can be interpreted as a end/begin triangle index for the previous/next solid. E.g., if there are 3 solids, the returned array would look like this: {sol1Begin, sol1End/sol2Begin, sol2End/sol3Begin, sol3End}.
|
References stl_reader::stl_reader_impl::RemoveDoubles(), STL_READER_COND_THROW, and STL_READER_THROW.
Referenced by ReadStlFile().
bool stl_reader::ReadStlFile_BINARY | ( | const char * | filename, |
TNumberContainer & | coordsOut, | ||
TNumberContainer & | normalsOut, | ||
TIndexContainer & | trisOut, | ||
TIndexContainer & | solidRangesOut | ||
) |
Reads a binary stl file into several arrays.
Reads a stl file and writes its coordinates, normals and triangle-corner-indices to the provided containers. It also fills a container solidRangesOut, which provides the triangle ranges for individual solids.
Double vertex entries are removed on the fly, so that triangle corners with equal coordinates are represented by a single coordinate entry in coordsOut.
filename | [in] The name of the file which shall be read |
coordsOut | [out] Coordinates are written to this container. On termination, it has size numVertices * 3. Each triple of entries forms a 3d coordinate. The type TNumberContainer should have the same interface as std::vector<float>. |
normalsOut | [out] Face normals are written to this container. On termination, it has size numFaces * 3. Each triple of entries forms a 3d normal. The type TNumberContainer should have the same interface as std::vector<float>. |
trisOut | [out] Triangle corner indices are written to this container. On termination, it has size numFaces * 3. Each triple of entries defines a triangle. The type TIndexContainer should have the same interface as std::vector<size_t>. Multiply corner indices from trisOut by 3 to obtain the index of the first coordinate of that corner in coordsOut. |
solidRangesOut | [out] On termination, it holds the ranges of triangle indices for each solid. It has the size numSolids + 1. Each entry can be interpreted as a end/begin triangle index for the previous/next solid. E.g., if there are 3 solids, the returned array would look like this: {sol1Begin, sol1End/sol2Begin, sol2End/sol3Begin, sol3End}.
|
References stl_reader::stl_reader_impl::RemoveDoubles(), and STL_READER_COND_THROW.
Referenced by ReadStlFile().
|
inline |
Determines whether a stl file has ASCII format.
The underlying mechanism is simply checks whether the provided file starts with the keyword solid. This should work for many stl files, but may fail, of course.
References STL_READER_COND_THROW.
Referenced by ReadStlFile().