CGAL 6.0.1 - 3D Point Set
Loading...
Searching...
No Matches

I/O Functions for the Polygon File Format (PLY).

Functions

template<typename Point , typename Vector >
bool CGAL::IO::read_PLY (std::istream &is, CGAL::Point_set_3< Point, Vector > &point_set, std::string &comments)
 reads a point set with properties from an input stream in ASCII or binary Polygon File Format (PLY).
 
template<typename Point , typename Vector , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_PLY (const std::string &fname, CGAL::Point_set_3< Point, Vector > &point_set, std::string &comments, const NamedParameters &np=parameters::default_values())
 reads a point set with properties from an input stream in ASCII or binary Polygon File Format (PLY).
 
template<typename Point , typename Vector , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_PLY (std::ostream &os, const CGAL::Point_set_3< Point, Vector > &point_set, const std::string &comments, const NamedParameters &np=parameters::default_values())
 writes a point set with properties in an output stream in the Polygon File Format (PLY).
 
template<typename Point , typename Vector , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_PLY (const std::string &fname, const CGAL::Point_set_3< Point, Vector > &point_set, const std::string &comments, const NamedParameters &np)
 writes a point set with properties in an output stream in the Polygon File Format (PLY).
 

Function Documentation

◆ read_PLY() [1/2]

template<typename Point , typename Vector , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_PLY ( const std::string &  fname,
CGAL::Point_set_3< Point, Vector > &  point_set,
std::string &  comments,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Point_set_3/IO/PLY.h>

reads a point set with properties from an input stream in ASCII or binary Polygon File Format (PLY).

  • the operator reads the vertex point property;
  • if three PLY properties nx, ny and nz with type float or double are found, the normal map is added;
  • if any other PLY property is found, a "[name]" property map is added, where [name] is the name of the PLY property.

The comments parameter can be omitted. If provided, it will be used to store the potential comments found in the PLY header. Each line starting by "comment " in the header is appended to the comments string (without the "comment " word).

Template Parameters
Pointthe point type of the Point_set_3
Vectorthe vector type of the Point_set_3
NamedParametersa sequence of Named Parameters
Parameters
fnamethe path to the input file
point_setthe point set
commentsoptional PLY comments.
npoptional Named Parameters described below
Optional Named Parameters
  • indicates whether data should be read in binary (true) or in ASCII (false)
  • Type: Boolean
  • Default: true
Returns
true if the reading was successful, false otherwise.

◆ read_PLY() [2/2]

template<typename Point , typename Vector >
bool CGAL::IO::read_PLY ( std::istream &  is,
CGAL::Point_set_3< Point, Vector > &  point_set,
std::string &  comments 
)

#include <CGAL/Point_set_3/IO/PLY.h>

reads a point set with properties from an input stream in ASCII or binary Polygon File Format (PLY).

  • the operator reads the vertex point property;
  • if three PLY properties nx, ny and nz with type float or double are found, the normal map is added;
  • if any other PLY property is found, a "[name]" property map is added, where [name] is the name of the PLY property.

The comments parameter can be omitted. If provided, it will be used to store the potential comments found in the PLY header. Each line starting by "comment " in the header is appended to the comments string (without the "comment " word).

Attention
To read a binary file, the flag std::ios::binary must be set during the creation of the ifstream.
Parameters
isthe input stream
point_setthe point set
commentsoptional PLY comments.
Returns
true if the reading was successful, false otherwise.

◆ write_PLY() [1/2]

template<typename Point , typename Vector , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_PLY ( const std::string &  fname,
const CGAL::Point_set_3< Point, Vector > &  point_set,
const std::string &  comments,
const NamedParameters &  np 
)

#include <CGAL/Point_set_3/IO/PLY.h>

writes a point set with properties in an output stream in the Polygon File Format (PLY).

If it exists, the normal map is written in the file. All other properties with simple types are written in the file.

If provided, the comments string is included line by line in the header of the PLY stream (each line will be precedeed by "comment ").

Template Parameters
Pointthe point type of the Point_set_3
Vectorthe vector type of the Point_set_3
NamedParametersa sequence of Named Parameters
Parameters
fnamethe path to the output file
point_setthe point set
commentsoptional PLY comments
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • indicates whether data should be read in binary (true) or in ASCII (false)
  • Type: Boolean
  • Default: true

  • a parameter used to set the precision (i.e. how many digits are generated) of the output stream
  • Type: int
  • Default: 6
  • Extra: This parameter is only meaningful while using ASCII encoding.
Returns
true if the reading was successful, false otherwise.

◆ write_PLY() [2/2]

template<typename Point , typename Vector , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_PLY ( std::ostream &  os,
const CGAL::Point_set_3< Point, Vector > &  point_set,
const std::string &  comments,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Point_set_3/IO/PLY.h>

writes a point set with properties in an output stream in the Polygon File Format (PLY).

If it exists, the normal map is inserted in the stream. All other properties with simple types are inserted in the stream.

If provided, the comments string is included line by line in the header of the PLY stream (each line will be precedeed by "comment ").

Attention
To write to a binary file, the flag std::ios::binary must be set during the creation of the ofstream, and the IO::Mode of the stream must be set to BINARY.
Template Parameters
Pointthe point type of the Point_set_3
Vectorthe vector type of the Point_set_3
NamedParametersa sequence of Named Parameters
Parameters
osthe output stream
point_setthe point set
commentsoptional PLY comments
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a parameter used to set the precision (i.e. how many digits are generated) of the output stream
  • Type: int
  • Default: the precision of the stream os
  • Extra: This parameter is only meaningful while using ASCII encoding.
Returns
true if the reading was successful, false otherwise.