IO functions.
More...
|
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< Mesh > pMesh, bool bASCII) |
| Write mesh to a file. More...
|
|
Read/Write functions for point clouds and triangle meshes.
◆ 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.
|
◆ getFileType()
FileType GEOM_WOF::getFileType |
( |
const std::string & |
filename | ) |
|
◆ 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
- Note
- This function reads also colors whose ply properties are named 'red','green','blue' or alternatively 'r','g','b'. Alpha can be named 'alpha' or 'scalar_Intensity'. Values are stored as unsigned char i.e., 0-255 and are automatically scaled up if given in the range 0.0-1.0 or scaled down if >255.0.
◆ 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] | inFilename | is the input filename |
[out] | vPoints | is used to return the points |
- Returns
- true in case of success, false otherwise
- See also
- In case of a *.ply file colors are also read, see readPly() for details on colors.
◆ 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< Mesh > |
pMesh, |
|
|
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] | filename | is the output filename |
[in] | pMesh | is the mesh to be written |
[in] | bASCII | specifies 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] | outFilename | is the output filename |
[in] | vPoints | contains the points to be written |
[in] | bASCII | specifies 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] | filename | is the output filename |
[in] | vPoints | contains the points to be written |
- Returns
- true when the operation was successful or false otherwise
- See also
- readPoints_BIN()