\( \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.12 - 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 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...
 
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 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...
 

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.
npoptional sequence of Named Parameters among the ones listed below.
Named Parameters
point_mapa model of WritablePropertyMap with value type geom_traits::Point_3. If this parameter is omitted, CGAL::Identity_property_map<geom_traits::Point_3> is used.
normal_mapa model of ReadWritePropertyMap with value type geom_traits::Vector_3. If this parameter is omitted, normals in the input stream are ignored.
geom_traitsan instance of a geometric traits class, model of Kernel
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.
npoptional sequence of Named Parameters among the ones listed below.
Named Parameters
point_mapa model of WritablePropertyMap with value type geom_traits::Point_3. If this parameter is omitted, CGAL::Identity_property_map<geom_traits::Point_3> is used.
normal_mapa model of ReadWritePropertyMap with value type geom_traits::Vector_3. If this parameter is omitted, normals in the input stream are ignored.
geom_traitsan instance of a geometric traits class, model of Kernel
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).

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.
npoptional sequence of Named Parameters among the ones listed below.
Named Parameters
point_mapa model of ReadablePropertyMap with value type geom_traits::Point_3. If this parameter is omitted, CGAL::Identity_property_map<geom_traits::Point_3> is used.
normal_mapa model of ReadablePropertyMap with value type geom_traits::Vector_3. If this parameter is omitted, normals are not written to the output stream.
geom_traitsan instance of a geometric traits class, model of Kernel
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.
npoptional sequence of Named Parameters among the ones listed below.
Named Parameters
point_mapa model of ReadablePropertyMap with value type geom_traits::Point_3. If this parameter is omitted, CGAL::Identity_property_map<geom_traits::Point_3> is used.
normal_mapa model of ReadablePropertyMap with value type geom_traits::Vector_3. If this parameter is omitted, normals are not written to the output stream.
geom_traitsan instance of a geometric traits class, model of Kernel
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.