Fade2.5D Documentation pages v2.16.7
Delaunay Features
File I/O

Functions

CLASS_DECLSPEC bool GEOM_FADE25D::readPointsBIN (const char *filename, std::vector< Point2 > &vPoints, bool bWithHeader=true)
 Read points from a binary file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::readPointsPLY (const char *filename, bool bUniquePoints, std::vector< Point2 > &vPoints, std::vector< VtxColor > *pVertexColors=NULL)
 Read points from a *.PLY file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::readPointsPLY (std::istream &is, bool bUniquePoints, std::vector< Point2 > &vPoints, std::vector< VtxColor > *pVertexColors=NULL)
 Read points from a *.PLY file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::readSegmentsBIN (const char *filename, std::vector< Segment2 > &vSegmentsOut)
 Read segments from a binary file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::readXY (const char *filename, std::vector< Point2 > &vPointsOut)
 Read (x y) points from an ASCII file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::readXYZ (const char *filename, std::vector< Point2 > &vPointsOut)
 Read (x y z) points from an ASCII file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::writePointsASCII (const char *filename, const std::vector< Point2 * > &vPointsIn)
 Write points to an ASCII file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::writePointsASCII (const char *filename, const std::vector< Point2 > &vPointsIn)
 Write points to an ASCII file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::writePointsBIN (const char *filename, std::vector< Point2 * > &vPoints)
 Write points to a binary file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::writePointsBIN (const char *filename, std::vector< Point2 > &vPoints)
 Write points to a binary file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::writePointsPLY (const char *filename, std::vector< Point2 * > &vPoints, bool bASCII)
 Write points to a *.PLY file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::writePointsPLY (std::ostream &os, std::vector< Point2 * > &vPoints, bool bASCII)
 Write points to a *.PLY file. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::writeSegmentsBIN (const char *filename, std::vector< Segment2 > &vSegmentsIn)
 Write segments to a binary file. More...
 

Detailed Description

Function Documentation

◆ readPointsBIN()

CLASS_DECLSPEC bool GEOM_FADE25D::readPointsBIN ( const char *  filename,
std::vector< Point2 > &  vPoints,
bool  bWithHeader = true 
)

This function reads points from a binary file into the provided vector. The format of the file can either include a header (written by writePointsBIN()) or it can contain just a sequence of double precision coordinates without a header.

Parameters
[in]filenameThe name of the input binary file to read from.
[out]vPointsA vector where the read points will be stored.
[in]bWithHeaderSpecifies if the file contains a header:
  • true if the file includes a header (written by writePointsBIN()).
  • false if the file contains just a sequence of double precision coordinates, with no header.
See also
writePointsBIN()

◆ readPointsPLY() [1/2]

CLASS_DECLSPEC bool GEOM_FADE25D::readPointsPLY ( const char *  filename,
bool  bUniquePoints,
std::vector< Point2 > &  vPoints,
std::vector< VtxColor > *  pVertexColors = NULL 
)

This function reads points from a *.PLY file and stores them in the provided vector. Optionally, the function can also read associated vertex colors if specified.

Parameters
[out]vPointsA vector where the read points will be stored.
[in]filenameThe name of the input *.PLY file to read from.
[in]bUniquePointsSpecifies whether to read a unique set of points or point triples (3 points per triangle):
  • true to read a unique set of points.
  • false to read point triples (3 points per triangle).
[in]pVertexColorsA pointer to a vector where vertex colors will be stored. Default is NULL.
Note
If pVertexColors is not NULL, the function will store colors from the *.PLY file in *pVertexColors. Additionally, indices to these colors will be stored in the points, which can be retrieved using the Point2::getCustomIndex() function.
Attention
This function requires at least C++11 and is not available on very old platforms.

◆ readPointsPLY() [2/2]

CLASS_DECLSPEC bool GEOM_FADE25D::readPointsPLY ( std::istream &  is,
bool  bUniquePoints,
std::vector< Point2 > &  vPoints,
std::vector< VtxColor > *  pVertexColors = NULL 
)

This function reads points from a *.PLY file and stores them in the provided vector. Optionally, the function can also read associated vertex colors if specified.

Parameters
[out]vPointsA vector where the read points will be stored.
[in]isThe input stream to read from.
[in]bUniquePointsSpecifies whether to read a unique set of points or point triples (3 points per triangle):
  • true to read a unique set of points.
  • false to read point triples (3 points per triangle).
[in]pVertexColorsA pointer to a vector where vertex colors will be stored. Default is NULL.
Note
If pVertexColors is not NULL, the function will store colors from the *.PLY file in *pVertexColors. Additionally, indices to these colors will be stored in the points, which can be retrieved using the Point2::getCustomIndex() function.
Attention
This function requires at least C++11 and is not available on very old platforms.

◆ readSegmentsBIN()

CLASS_DECLSPEC bool GEOM_FADE25D::readSegmentsBIN ( const char *  filename,
std::vector< Segment2 > &  vSegmentsOut 
)

This function reads segments from a binary file and stores them in the provided vector.

Parameters
[in]filenameThe name of the binary file to read.
[out]vSegmentsOutA vector where the read segments will be stored.
Returns
true if the segments were successfully read, false otherwise.
See also
writeSegmentsBIN()

◆ readXY()

CLASS_DECLSPEC bool GEOM_FADE25D::readXY ( const char *  filename,
std::vector< Point2 > &  vPointsOut 
)

This function reads points from an ASCII file. Each line in the file contains two coordinates (x, y), separated by whitespace.

The z coordinate of the output points is set to 0.

Parameters
[in]filenameThe name of the ASCII file containing the points.
[out]vPointsOutA vector where the read points will be stored.
Returns
true if the points were successfully read, false otherwise.

◆ readXYZ()

CLASS_DECLSPEC bool GEOM_FADE25D::readXYZ ( const char *  filename,
std::vector< Point2 > &  vPointsOut 
)

This function reads points from an ASCII file. The expected file format is three coordinates (x, y, z) per line, with whitespace separating the values.

Parameters
[in]filenameThe input file containing the points.
[out]vPointsOutA vector that will store the read points.
Returns
true if the points were successfully read, false otherwise.

◆ writePointsASCII() [1/2]

CLASS_DECLSPEC bool GEOM_FADE25D::writePointsASCII ( const char *  filename,
const std::vector< Point2 * > &  vPointsIn 
)

This function writes points to an ASCII file. The format is:

  • Three coordinates (x, y, z) per line. The coordinates are separated by whitespace.
Parameters
[in]filenameThe name of the output file where points will be written.
[in]vPointsInA vector containing pointers to the points to be written to the file.
Returns
true if the points were successfully written, false otherwise.
Note
Data exchange through ASCII files is easy and convenient, but floating point coordinates are not necessarily exact when represented as decimal numbers. If tiny rounding errors are not acceptable in your application, you are advised to write binary files using writePointsBIN() or writePointsPLY().

◆ writePointsASCII() [2/2]

CLASS_DECLSPEC bool GEOM_FADE25D::writePointsASCII ( const char *  filename,
const std::vector< Point2 > &  vPointsIn 
)

This function writes points to an ASCII file. The file format consists of two coordinates (x, y) per line, whitespace separated.

Parameters
[in]filenameThe name of the output file where the points will be written.
[in]vPointsInA vector containing the points to be written to the file.
Returns
true if the points were successfully written, false otherwise.
See also
readPointsASCII()

◆ writePointsBIN() [1/2]

CLASS_DECLSPEC bool GEOM_FADE25D::writePointsBIN ( const char *  filename,
std::vector< Point2 * > &  vPoints 
)

This function writes points to a binary file. The file format consists of:

  • An integer filetype:
    • 30 for 2.5D data
  • A size_t indicating the number of points.
  • For each point, three double values representing the coordinates:
    • x, y, and z.
Parameters
[in]filenameThe name of the output binary file.
[in]vPointsA vector of pointers to points to be written to the file.
Returns
true if the points were successfully written, false otherwise.
Attention
The size_t type is 8 bytes on 64-bit platforms but only 4 bytes on 32-bit platforms. This format always uses 8 bytes for compatibility across architectures.

◆ writePointsBIN() [2/2]

CLASS_DECLSPEC bool GEOM_FADE25D::writePointsBIN ( const char *  filename,
std::vector< Point2 > &  vPoints 
)

This function writes points to a binary file. The file format consists of:

  • An integer filetype:
    • 30 for 2.5D data
  • A size_t indicating the number of points.
  • For each point, three double values representing the coordinates:
    • x, y, and z.
Parameters
[in]filenameThe name of the output binary file.
[in]vPointsA vector containing the points to be written to the file.
Returns
true if the points were successfully written, false otherwise.
Attention
The size_t type is 8 bytes on 64-bit platforms but only 4 bytes on 32-bit platforms. This format always uses 8 bytes for compatibility across architectures.

◆ writePointsPLY() [1/2]

CLASS_DECLSPEC bool GEOM_FADE25D::writePointsPLY ( const char *  filename,
std::vector< Point2 * > &  vPoints,
bool  bASCII 
)

This function writes points to a *.PLY file in either ASCII or binary format.

Parameters
[in]vPointsA vector of pointers to points to be written to the *.PLY file.
[in]bASCIISpecifies whether to write the file in ASCII format (true) or binary format (false).
[in]filenameThe output file where the *.PLY file will be written.
Attention
This function requires at least C++11. It is not available on very old platforms.

◆ writePointsPLY() [2/2]

CLASS_DECLSPEC bool GEOM_FADE25D::writePointsPLY ( std::ostream &  os,
std::vector< Point2 * > &  vPoints,
bool  bASCII 
)

This function writes points to a *.PLY file in either ASCII or binary format.

Parameters
[in]vPointsA vector of points to be written to the *.PLY file.
[in]bASCIISpecifies whether to write the file in ASCII format (true) or binary format (false).
[in]osThe output stream where the *.PLY file will be written.
Attention
This function requires at least C++11. It is not available on very old platforms.

◆ writeSegmentsBIN()

CLASS_DECLSPEC bool GEOM_FADE25D::writeSegmentsBIN ( const char *  filename,
std::vector< Segment2 > &  vSegmentsIn 
)

Writes segments to a binary file with the following format:

Binary file format:

  • int filetype (31)
  • size_t numSegments (vSegmentsIn.size())
  • double x0_source
  • double y0_source
  • double z0_source
  • double x0_target
  • double y0_target
  • double z0_target ...
  • double xn_source
  • double yn_source
  • double zn_source
  • double xn_target
  • double yn_target
  • double zn_target
See also
readSegmentsBIN()