CGAL 5.2.1 - Point Set Processing

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< FT >, PLY_property< FT >, PLY_property< FT > > 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< FT >, PLY_property< FT >, PLY_property< FT > > 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 NamedParameters >
bool CGAL::read_ply_points (std::istream &stream, OutputIterator output, const NamedParameters &np)
 Reads points (positions + normals, if available) from a .ply stream (ASCII or binary). More...
 
template<typename PointMap >
std::tuple< PointMap, PLY_property< FT >, PLY_property< FT >, PLY_property< FT > > 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< FT >, PLY_property< FT >, PLY_property< FT > > CGAL::make_ply_normal_writer (VectorMap normal_map)
 Generates a PLY property handler to write 3D normal vectors. More...
 
template<typename PointRange , typename ... PropertyHandler>
bool CGAL::write_ply_points_with_properties (std::ostream &stream, const PointRange &points, PropertyHandler &&... properties)
 Saves the range of points with properties to a .ply stream. More...
 
template<typename PointRange , typename NamedParameters >
bool CGAL::write_ply_points (std::ostream &stream, const PointRange &points, const NamedParameters &np)
 Saves the range of points (positions + normals, if available) to a .ply stream. More...
 

Function Documentation

◆ make_ply_normal_reader()

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

#include <CGAL/IO/read_ply_points.h>

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

Vectors are constructed from the input using 3 PLY properties of type FT and named nx, ny and nz. FT is float if the points use CGAL::Simple_cartesian<float> and double otherwise.

See also
read_ply_points_with_properties()
Template Parameters
VectorMapthe property map used to store vectors.
Examples:
Point_set_processing_3/read_ply_points_with_colors_example.cpp.

◆ make_ply_normal_writer()

template<typename VectorMap >
std::tuple<VectorMap, PLY_property<FT>, PLY_property<FT>, PLY_property<FT> > CGAL::make_ply_normal_writer ( VectorMap  normal_map)

#include <CGAL/IO/write_ply_points.h>

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

Vectors are written as 3 PLY properties of type FT and named nx, ny and nz. FT is float if the vectors use CGAL::Simple_cartesian<float> and double otherwise.

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

◆ make_ply_point_reader()

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

#include <CGAL/IO/read_ply_points.h>

Generates a PLY property handler to read 3D points.

Points are constructed from the input using 3 PLY properties of type FT and named x, y and z. FT is float if the points use CGAL::Simple_cartesian<float> and double otherwise.

See also
read_ply_points_with_properties()
Template Parameters
PointMapthe property map used to store points.
Examples:
Point_set_processing_3/read_ply_points_with_colors_example.cpp.

◆ make_ply_point_writer()

template<typename PointMap >
std::tuple<PointMap, PLY_property<FT>, PLY_property<FT>, PLY_property<FT> > CGAL::make_ply_point_writer ( PointMap  point_map)

#include <CGAL/IO/write_ply_points.h>

Generates a PLY property handler to write 3D points.

Points are written as 3 PLY properties of type FT and named x, y and z. FT is float if the points use CGAL::Simple_cartesian<float> and double otherwise.

See also
write_ply_points_with_properties()
Template Parameters
PointMapthe property map used to store points.
Examples:
Point_set_processing_3/write_ply_points_example.cpp.

◆ read_ply_points()

template<typename OutputIteratorValueType , typename OutputIterator , typename NamedParameters >
bool CGAL::read_ply_points ( std::istream &  stream,
OutputIterator  output,
const NamedParameters &  np 
)

#include <CGAL/IO/read_ply_points.h>

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.
Parameters
streaminput stream.
outputoutput iterator over points.
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters

  • a property map associating normals to the elements of the poing range
  • Type: a model of ReadWritePropertyMap with value type geom_traits::Vector_3
  • Default: If this parameter is omitted, normals in the input stream are ignored.

Returns
true on success.
Warning
This function requires a C++11 compiler.
Examples:
Point_set_processing_3/registration_with_OpenGR.cpp, Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp, and Point_set_processing_3/registration_with_pointmatcher.cpp.

◆ write_ply_points()

template<typename PointRange , typename NamedParameters >
bool CGAL::write_ply_points ( std::ostream &  stream,
const PointRange &  points,
const NamedParameters &  np 
)

#include <CGAL/IO/write_ply_points.h>

Saves the range of points (positions + normals, if available) to a .ply stream.

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

Template Parameters
PointRangeis a model of ConstRange. The value type of its iterator is the key type of the named parameter point_map.
Parameters
streamoutput stream.
pointsinput point range.
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters

  • a property map associating normals to the elements of the poing range
  • Type: a model of ReadablePropertyMap with value type geom_traits::Vector_3
  • Default: If this parameter is omitted, normals are not written in the output stream.

Returns
true on success.
Warning
This function requires a C++11 compiler.
Examples:
Point_set_processing_3/orient_scanlines_example.cpp, Point_set_processing_3/registration_with_OpenGR.cpp, Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp, and Point_set_processing_3/registration_with_pointmatcher.cpp.

◆ write_ply_points_with_properties()

template<typename PointRange , typename ... PropertyHandler>
bool CGAL::write_ply_points_with_properties ( std::ostream &  stream,
const PointRange &  points,
PropertyHandler &&...  properties 
)

#include <CGAL/IO/write_ply_points.h>

Saves the 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
PointRangeis a model of ConstRange. The value type of its iterator is the key type of the PropertyMap objects provided within the PropertyHandler parameter.
PropertyHandlerhandlers to recover properties.
Returns
true on success.
Parameters
streamoutput stream.
pointsinput point range.
propertiesparameter pack of property handlers
Examples:
Point_set_processing_3/write_ply_points_example.cpp.