\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.11.3 - Point Set Processing
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

Read and write points (with or without additional properties) in PLY format.

Classes

struct  CGAL::PLY_property< T >
 Class used to identify a PLY property as a type and a name. More...
 

Functions

template<typename PointMap >
std::tuple< PointMap, typename
Kernel_traits< typename
PointMap::value_type >
::Kernel::Construct_point_3,
PLY_property< double >
, PLY_property< double >
, PLY_property< double > > 
CGAL::make_ply_point_reader (PointMap point_map)
 Generates a PLY property handler to read 3D points. More...
 
template<typename VectorMap >
std::tuple< VectorMap,
typename Kernel_traits
< typename
VectorMap::value_type >
::Kernel::Construct_vector_3,
PLY_property< double >
, PLY_property< double >
, PLY_property< double > > 
CGAL::make_ply_normal_reader (VectorMap normal_map)
 Generates a PLY property handler to read 3D normal vectors. More...
 
template<typename OutputIteratorValueType , typename OutputIterator , typename... PropertyHandler>
bool CGAL::read_ply_points_with_properties (std::istream &stream, OutputIterator output, PropertyHandler &&...properties)
 Reads user-selected points properties from a .ply stream (ASCII or binary). More...
 
template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap , typename NormalPMap >
bool CGAL::read_ply_points_and_normals (std::istream &stream, OutputIterator output, PointPMap point_pmap, NormalPMap normal_pmap)
 Reads points (positions + normals, if available) from a .ply stream (ASCII or binary). More...
 
template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap >
bool CGAL::read_ply_points (std::istream &stream, OutputIterator output, PointPMap point_pmap)
 Reads points (position only) from a .ply stream (ASCII or binary). More...
 
template<typename PointMap >
std::tuple< PointMap,
PLY_property< double >
, PLY_property< double >
, PLY_property< double > > 
CGAL::make_ply_point_writer (PointMap point_map)
 Generates a PLY property handler to write 3D points. More...
 
template<typename VectorMap >
std::tuple< VectorMap,
PLY_property< double >
, PLY_property< double >
, PLY_property< double > > 
CGAL::make_ply_normal_writer (VectorMap normal_map)
 Generates a PLY property handler to write 3D normal vectors. More...
 
template<typename ForwardIterator , typename... PropertyHandler>
bool CGAL::write_ply_points_with_properties (std::ostream &stream, ForwardIterator first, ForwardIterator beyond, PropertyHandler &&...properties)
 Saves the [first, beyond) range of points with properties to a .ply stream. More...
 
template<typename ForwardIterator , typename PointMap , typename VectorMap >
bool CGAL::write_ply_points_and_normals (std::ostream &stream, ForwardIterator first, ForwardIterator beyond, PointMap point_map, VectorMap normal_map)
 Saves the [first, beyond) range of points (positions + normals) to a .ply stream. More...
 
template<typename ForwardIterator , typename PointMap >
bool CGAL::write_ply_points (std::ostream &stream, ForwardIterator first, ForwardIterator beyond, PointMap point_map)
 Saves the [first, beyond) range of points (positions only) to a .ply stream. More...
 

Function Documentation

template<typename VectorMap >
std::tuple<VectorMap, typename Kernel_traits<typename VectorMap::value_type>::Kernel::Construct_vector_3, PLY_property<double>, PLY_property<double>, PLY_property<double> > CGAL::make_ply_normal_reader ( VectorMap  normal_map)

Generates a PLY property handler to read 3D normal vectors.

Vectors are constructed from the input using 3 PLY properties of type double and named nx, ny and nz.

See Also
read_ply_points_with_properties()
Template Parameters
VectorMapthe property map used to store vectors.

#include <CGAL/IO/read_ply_points.h>

Examples:
Point_set_processing_3/read_ply_points_with_colors_example.cpp.
template<typename VectorMap >
std::tuple<VectorMap, PLY_property<double>, PLY_property<double>, PLY_property<double> > CGAL::make_ply_normal_writer ( VectorMap  normal_map)

Generates a PLY property handler to write 3D normal vectors.

Vectors are written as 3 PLY properties of type double and named nx, ny and nz.

See Also
write_ply_points_with_properties()
Template Parameters
VectorMapthe property map used to store vectors.

#include <CGAL/IO/write_ply_points.h>

template<typename PointMap >
std::tuple<PointMap, typename Kernel_traits<typename PointMap::value_type>::Kernel::Construct_point_3, PLY_property<double>, PLY_property<double>, PLY_property<double> > CGAL::make_ply_point_reader ( PointMap  point_map)

Generates a PLY property handler to read 3D points.

Points are constructed from the input using 3 PLY properties of type double and named x, y and z.

See Also
read_ply_points_with_properties()
Template Parameters
PointMapthe property map used to store points.

#include <CGAL/IO/read_ply_points.h>

Examples:
Point_set_processing_3/read_ply_points_with_colors_example.cpp.
template<typename PointMap >
std::tuple<PointMap, PLY_property<double>, PLY_property<double>, PLY_property<double> > CGAL::make_ply_point_writer ( PointMap  point_map)

Generates a PLY property handler to write 3D points.

Points are written as 3 PLY properties of type double and named x, y and z.

See Also
write_ply_points_with_properties()
Template Parameters
PointMapthe property map used to store points.

#include <CGAL/IO/write_ply_points.h>

Examples:
Point_set_processing_3/write_ply_points_example.cpp.
template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap >
bool CGAL::read_ply_points ( std::istream &  stream,
OutputIterator  output,
PointPMap  point_pmap 
)

Reads points (position only) from a .ply stream (ASCII or binary).

Potential additional point properties (including normals) and faces are ignored.

Template Parameters
OutputIteratorValueTypetype of objects that can be put in OutputIterator. It is default to value_type_traits<OutputIterator>::type and can be omitted when the default is fine.
OutputIteratoriterator over output points.
PointPMapis a model of WritablePropertyMap with value_type CGAL::Point_3. It can be omitted if the value type of OutputIterator is convertible to CGAL::Point_3.
Returns
true on success.
Warning
This function requires a C++11 compiler.
Parameters
streaminput stream.
outputoutput iterator over points.
point_pmapproperty map: value_type of OutputIterator -> Point_3.

#include <CGAL/IO/read_ply_points.h>

template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap , typename NormalPMap >
bool CGAL::read_ply_points_and_normals ( std::istream &  stream,
OutputIterator  output,
PointPMap  point_pmap,
NormalPMap  normal_pmap 
)

Reads points (positions + normals, if available) from a .ply stream (ASCII or binary).

Potential additional point properties and faces are ignored.

Template Parameters
OutputIteratorValueTypetype of objects that can be put in OutputIterator. It is default to value_type_traits<OutputIterator>::type and can be omitted when the default is fine.
OutputIteratoriterator over output points.
PointPMapis a model of WritablePropertyMap with value type CGAL::Point_3.
NormalPMapis a model of WritablePropertyMap with value type CGAL::Vector_3.
Returns
true on success.
Warning
This function requires a C++11 compiler.
Parameters
streaminput stream.
outputoutput iterator over points.
point_pmapproperty map: value_type of OutputIterator -> Point_3.
normal_pmapproperty map: value_type of OutputIterator -> Vector_3.

#include <CGAL/IO/read_ply_points.h>

template<typename OutputIteratorValueType , typename OutputIterator , typename... PropertyHandler>
bool CGAL::read_ply_points_with_properties ( std::istream &  stream,
OutputIterator  output,
PropertyHandler &&...  properties 
)

Reads user-selected points properties from a .ply stream (ASCII or binary).

Potential additional point properties and faces are ignored.

Properties are handled through a variadic list of property handlers. A PropertyHandler can either be:

  • A std::pair<PropertyMap, PLY_property<T> > if the user wants to read a PLY property as a scalar value T (for example, storing an int PLY property into an int variable).
  • A std::tuple<PropertyMap, Constructor, PLY_property<T>...> if the user wants to use one or several PLY properties to construct a complex object (for example, storing 3 uchar PLY properties into a Color object that can for example be a CGAL::cpp11::array<unsigned char, 3>). In that case, the second element of the tuple should be a functor that constructs the value type of PropertyMap from N objects of types T.
See Also
make_ply_point_reader()
make_ply_normal_reader()
Warning
This function requires a C++11 compiler.
Template Parameters
OutputIteratorValueTypetype of objects that can be put in OutputIterator. It is default to value_type_traits<OutputIterator>::type and can be omitted when the default is fine.
OutputIteratoriterator over output points.
PropertyHandlerhandlers to recover properties.
Returns
true on success.

#include <CGAL/IO/read_ply_points.h>

Examples:
Point_set_processing_3/read_ply_points_with_colors_example.cpp.
template<typename ForwardIterator , typename PointMap >
bool CGAL::write_ply_points ( std::ostream &  stream,
ForwardIterator  first,
ForwardIterator  beyond,
PointMap  point_map 
)

Saves the [first, beyond) range of points (positions only) to a .ply stream.

PLY is either ASCII or binary depending on the value of CGAL::get_mode(stream).

Template Parameters
ForwardIteratoriterator over input points.
PointMapis a model of ReadablePropertyMap with a value_type = CGAL::Point_3. It can be omitted if the value type of ForwardIterator is convertible to CGAL::Point_3.
Returns
true on success.
Warning
This function requires a C++11 compiler.
Parameters
streamoutput stream.
firstfirst input point.
beyondpast-the-end input point.
point_mapproperty map: value_type of OutputIterator -> Point_3.

#include <CGAL/IO/write_ply_points.h>

template<typename ForwardIterator , typename PointMap , typename VectorMap >
bool CGAL::write_ply_points_and_normals ( std::ostream &  stream,
ForwardIterator  first,
ForwardIterator  beyond,
PointMap  point_map,
VectorMap  normal_map 
)

Saves the [first, beyond) range of points (positions + normals) to a .ply stream.

PLY is either ASCII or binary depending on the value of CGAL::get_mode(stream).

Precondition
normals must be unit vectors
Template Parameters
ForwardIteratoriterator over input points.
PointMapis a model of ReadablePropertyMap with value type CGAL::Point_3. It can be omitted if the value type of ForwardIterator is convertible to CGAL::Point_3.
VectorMapis a model of ReadablePropertyMap with a value type CGAL::Vector_3.
Returns
true on success.
Warning
This function requires a C++11 compiler.
Parameters
streamoutput stream.
firstfirst input point.
beyondpast-the-end input point.
point_mapproperty map: value_type of OutputIterator -> Point_3.
normal_mapproperty map: value_type of OutputIterator -> Vector_3.

#include <CGAL/IO/write_ply_points.h>

template<typename ForwardIterator , typename... PropertyHandler>
bool CGAL::write_ply_points_with_properties ( std::ostream &  stream,
ForwardIterator  first,
ForwardIterator  beyond,
PropertyHandler &&...  properties 
)

Saves the [first, beyond) range of points with properties to a .ply stream.

PLY is either ASCII or binary depending on the value of CGAL::get_mode(stream).

Properties are handled through a variadic list of property handlers. A PropertyHandler can either be:

  • A std::pair<PropertyMap, PLY_property<T> > if the user wants to write a scalar value T as a PLY property (for example, writing an int variable as an int PLY property).
  • A std::tuple<PropertyMap, PLY_property<T>...> if the user wants to write a complex object as several PLY properties. In that case, a specialization of Output_rep must be provided for PropertyMap::value_type that handles both ASCII and binary output (see CGAL::get_mode()).
See Also
make_ply_point_writer()
make_ply_normal_writer()
Warning
This function requires a C++11 compiler.
Template Parameters
ForwardIteratoriterator over input points.
PropertyHandlerhandlers to recover properties.
Returns
true on success.
Parameters
streamoutput stream.
firstiterator over the first input point.
beyondpast-the-end iterator over the input points.
propertiesparameter pack of property handlers

#include <CGAL/IO/write_ply_points.h>

Examples:
Point_set_processing_3/write_ply_points_example.cpp.