CGAL 5.1.1 - 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

◆ read_off_points()

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
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.
Examples:
Point_set_processing_3/edges_example.cpp.

◆ read_xyz_points()

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
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.
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
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.

◆ 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
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.
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.