CGAL 5.1.3 - Point Set Processing
IO (XYZ/OFF Formats)

Read and write points (with or without normal vectors) in XYZ and OFF formats.

## Functions

template<typename OutputIteratorValueType , typename OutputIterator , typename NamedParameters >
bool CGAL::read_off_points (std::istream &stream, OutputIterator output, const NamedParameters &np)
Reads points (positions + normals, if available) from a .off ASCII stream. More...

template<typename OutputIteratorValueType , typename OutputIterator , typename NamedParameters >
bool CGAL::read_xyz_points (std::istream &stream, OutputIterator output, const NamedParameters &np)
Reads points (positions + normals, if available) from a .xyz ASCII stream. More...

template<typename PointRange , typename NamedParameters >
bool CGAL::write_off_points (std::ostream &stream, const PointRange &points, const NamedParameters &np)
Saves the range of points (positions + normals, if available) to a .off ASCII stream. More...

template<typename PointRange , typename NamedParameters >
bool CGAL::write_xyz_points (std::ostream &stream, const PointRange &points, const NamedParameters &np)
Saves the range of points (positions + normals, if available) to a .xyz ASCII stream. More...

## Function Documentation

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

#include <CGAL/IO/read_off_points.h>

Reads points (positions + normals, if available) from a .off ASCII stream.

The function expects for each point a line with the x y z position, optionally followed by the nx ny nz normal. Faces are ignored.

Template Parameters
 OutputIteratorValueType type of objects that can be put in OutputIterator. It is default to value_type_traits::type and can be omitted when the default is fine. OutputIterator iterator over output points.
Parameters
 stream input stream. output output iterator over points. np an optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
 a property map associating points to the elements of the point range Type: a model of WritablePropertyMap with value type geom_traits::Point_3 Default: CGAL::Identity_property_map 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. an instance of a geometric traits class Type: a model of Kernel Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
Returns
true on success.
Examples:
Point_set_processing_3/edges_example.cpp.

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

#include <CGAL/IO/read_xyz_points.h>

Reads points (positions + normals, if available) from a .xyz ASCII stream.

The function expects for each point a line with the x y z position, optionally followed by the nx ny nz normal. The first line may contain the number of points in the file. Empty lines and comments starting by # character are allowed.

Template Parameters
 OutputIteratorValueType type of objects that can be put in OutputIterator. It is default to value_type_traits::type and can be omitted when the default is fine. OutputIterator iterator over output points.
Parameters
 stream input stream. output output iterator over points. np an optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
 a property map associating points to the elements of the point range Type: a model of WritablePropertyMap with value type geom_traits::Point_3 Default: CGAL::Identity_property_map 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. an instance of a geometric traits class Type: a model of Kernel Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
Returns
true on success.
Examples:
Point_set_processing_3/average_spacing_example.cpp, Point_set_processing_3/bilateral_smooth_point_set_example.cpp, Point_set_processing_3/edge_aware_upsample_point_set_example.cpp, Point_set_processing_3/grid_simplification_example.cpp, Point_set_processing_3/hierarchy_simplification_example.cpp, Point_set_processing_3/normals_example.cpp, Point_set_processing_3/read_write_xyz_point_set_example.cpp, Point_set_processing_3/remove_outliers_example.cpp, Point_set_processing_3/scale_estimation_example.cpp, Point_set_processing_3/structuring_example.cpp, and Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp.

## ◆ write_off_points()

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

#include <CGAL/IO/write_off_points.h>

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

The function writes for each point a line with the x y z position followed by the nx ny nz normal (if available).

Note
The precision() of the output stream might not be sufficient depending on the data to be written.
Template Parameters
 PointRange is a model of ConstRange. The value type of its iterator is the key type of the named parameter point_map.
Parameters
 stream output stream. points input point range. np an optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
 a property map associating points to the elements of the point range Type: a model of ReadablePropertyMap with value type geom_traits::Point_3 Default: CGAL::Identity_property_map 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. an instance of a geometric traits class Type: a model of Kernel Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
Returns
true on success.

## ◆ write_xyz_points()

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

#include <CGAL/IO/write_xyz_points.h>

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

The function writes for each point a line with the x y z position followed by the nx ny nz normal (if available).

Template Parameters
 PointRange is a model of ConstRange. The value type of its iterator is the key type of the named parameter point_map.
Parameters
 stream output stream. points input point range. np an optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
 a property map associating points to the elements of the point range Type: a model of ReadablePropertyMap with value type geom_traits::Point_3 Default: CGAL::Identity_property_map 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. an instance of a geometric traits class Type: a model of Kernel Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
Returns
true on success.
Examples:
Point_set_processing_3/bilateral_smooth_point_set_example.cpp, Point_set_processing_3/edge_aware_upsample_point_set_example.cpp, Point_set_processing_3/hierarchy_simplification_example.cpp, Point_set_processing_3/read_write_xyz_point_set_example.cpp, Point_set_processing_3/structuring_example.cpp, and Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp.