Geom Software - C++ Programming and Geometry Libraries
WOF Documentation pages v1.04
File I/O

IO functions. More...

Enumerations

enum  GEOM_WOF::FileType {
  GEOM_WOF::FT_STL, GEOM_WOF::FT_PLY, GEOM_WOF::FT_XYZ, GEOM_WOF::FT_BIN,
  GEOM_WOF::FT_LIST, GEOM_WOF::FT_UNKNOWN
}
 Filetype. More...
 

Functions

FileType GEOM_WOF::getFileType (const std::string &filename)
 Get File Type. More...
 
bool GEOM_WOF::writePoints_ASCII (const char *filename, const std::vector< Point3 > &vPoints)
 Write points to an ASCII file. More...
 
bool GEOM_WOF::writePoints_BIN (const char *filename, std::vector< Point3 > &vPoints)
 Write points to a binary file. More...
 
bool GEOM_WOF::readPly (const char *filename, bool bReadPoints, std::vector< Point3 > &vPointsOut)
 Write points to a *.ply file. More...
 
bool GEOM_WOF::writePointsPly (const std::string &filename, std::vector< GEOM_WOF::Point3 > &vPoints, bool bASCII)
 
bool GEOM_WOF::readPoints_ASCII (const char *filename, std::vector< Point3 > &vPoints)
 Read points from an ASCII file. More...
 
bool GEOM_WOF::readPoints_BIN (const char *filename, std::vector< Point3 > &vPointsOut)
 Read points from a binary file. More...
 
bool GEOM_WOF::readSTL_ASCII (const char *filename, std::vector< Point3 > &vTriangleCorners)
 Read a mesh from ASCII STL. More...
 
bool GEOM_WOF::readPoints_auto (std::string &inFilename, std::vector< Point3 > &vPoints)
 Read points from a file (automatic detection) More...
 
bool GEOM_WOF::writePoints_auto (std::string &outFilename, std::vector< Point3 > &vPoints, bool bASCII)
 Write points to a file. More...
 
bool GEOM_WOF::writeMesh_auto (const std::string &filename, std::shared_ptr< WofMesh > pWofMesh, bool bASCII)
 Write mesh to a file. More...
 

Detailed Description

Read/Write functions for point clouds and triangle meshes.

Enumeration Type Documentation

◆ FileType

Enumerator
FT_STL 

FileType STL based on the filename extension [.stl].

FT_PLY 

FileType PLY based on the filename extension [.ply].

FT_XYZ 

FileType XYZ based on the filename extensions [.xyz|.txt|.asc].

FT_BIN 

FileType BIN based on the filename extension [.bin].

FT_LIST 

FileType LIST based on the filename extension [.list].

FT_UNKNOWN 

FileType UNKNOWN for unknown extensions.

Function Documentation

◆ getFileType()

FileType GEOM_WOF::getFileType ( const std::string &  filename)
Returns
the file type ( FT_STL, FT_PLY, FT_XYZ, FT_BIN, FT_LIST, FT_UNKNOWN) based on the filename extension.

◆ readPly()

bool GEOM_WOF::readPly ( const char *  filename,
bool  bReadPoints,
std::vector< Point3 > &  vPointsOut 
)
Parameters
filename[in] is the input filename
bReadPoints[in] Use true to get only the points of the *.ply file. Otherwise, when you are interested in the triangles then use false to get 3 subsequent corners per triangle.
vPointsOut[out] is used to return the points
Returns
true when the operation was successful or false otherwise

◆ readPoints_ASCII()

bool GEOM_WOF::readPoints_ASCII ( const char *  filename,
std::vector< Point3 > &  vPoints 
)

Reads points from a simple ASCII file. Expected file format: Three coordinates (x y z) per line, whitespace separated.

Parameters
filename[in] is the input filename
vPoints[out] is used to return the points
Returns
true [in] in case of success or false otherwise

◆ readPoints_auto()

bool GEOM_WOF::readPoints_auto ( std::string &  inFilename,
std::vector< Point3 > &  vPoints 
)

This function reads points from a *.ply-File (ASCII or binary), an *.xyz-File (ASCII, 3 coordinates per line), or a *.bin-File (simple binary format). The file type is automatically determined from the filename extension.

Parameters
[in]inFilenameis the input filename
[out]vPointsis used to return the points
Returns
true in case of success, false otherwise

◆ readPoints_BIN()

bool GEOM_WOF::readPoints_BIN ( const char *  filename,
std::vector< Point3 > &  vPointsOut 
)
Parameters
filename[in] is a binary input file
vPointsOut[out] is used to return the points
Returns
true in case of success or false otherwise
See also
writePoints_BIN()

◆ readSTL_ASCII()

bool GEOM_WOF::readSTL_ASCII ( const char *  filename,
std::vector< Point3 > &  vTriangleCorners 
)
Parameters
filename[in] is the input filename
vTriangleCorners[out] is used to return three points per triangle
Returns
true when the operation was successful or false otherwise

◆ writeMesh_auto()

bool GEOM_WOF::writeMesh_auto ( const std::string &  filename,
std::shared_ptr< WofMesh pWofMesh,
bool  bASCII 
)

This function writes a Mesh to file. Available formats are *.ply (ASCII or binary), *.stl (only ASCII) and Geomview-*.list (ASCII). The file type is automatically determined from the filename extension.

Parameters
[in]filenameis the output filename
[in]pWofMeshis the mesh to be written
[in]bASCIIspecifies that ASCII mode shall be used when the file can be written in ASCII- or binary mode (as it is the case for *.ply)
Returns
true in case of success or false otherwise

◆ writePoints_ASCII()

bool GEOM_WOF::writePoints_ASCII ( const char *  filename,
const std::vector< Point3 > &  vPoints 
)

Writes points to an ASCII file, three coordinates (x y z) per line, whitespace separated.

Note
Data exchange through ASCII files is easy and convenient but floating point coordinates are not necessarily exact when represented as decimal numbers and ASCII files are big compared to other formats. Thus writing binary files using writePoints_BIN() is recommended.
Parameters
filename[in] is the output filename
vPoints[in] contains the points to be written
Returns
true when the operation was successful or false otherwise.

◆ writePoints_auto()

bool GEOM_WOF::writePoints_auto ( std::string &  outFilename,
std::vector< Point3 > &  vPoints,
bool  bASCII 
)

This function writes points to a *.ply-File, *.xyz-File (ASCII, 3 coordinates per line), or a *.bin-File (simple binary format). The file type is automatically determined from the filename extension.

Parameters
[in]outFilenameis the output filename
[in]vPointscontains the points to be written
[in]bASCIIspecifies that ASCII mode shall be used when the file can be written in ASCII- or binary mode (as it is the case for *.ply)
Returns
true in case of success or false otherwise

◆ writePoints_BIN()

bool GEOM_WOF::writePoints_BIN ( const char *  filename,
std::vector< Point3 > &  vPoints 
)

Writes a binary file, the format is: (int,size_t,double,...,double)
Thereby the first int is always 30, the size_t value is vPoints.size() and the double precision values are x0,y0,z0,...,xn,yn,zn.

Parameters
[in]filenameis the output filename
[in]vPointscontains the points to be written
Returns
true when the operation was successful or false otherwise
See also
readPoints_BIN()