\( \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 - Point Set Processing
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
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 PointPMap , typename NormalPMap , typename Kernel >
bool CGAL::read_off_points_and_normals (std::istream &stream, OutputIterator output, PointPMap point_pmap, NormalPMap normal_pmap, const Kernel &)
 Reads points (positions + normals, if available) from a .off ASCII stream. More...
 
template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap , typename Kernel >
bool CGAL::read_off_points (std::istream &stream, OutputIterator output, PointPMap point_pmap, const Kernel &kernel)
 Reads points (position only) from a .off ASCII stream. More...
 
template<typename ForwardIterator , typename PointPMap , typename NormalPMap , typename Kernel >
bool CGAL::write_xyz_points_and_normals (std::ostream &stream, ForwardIterator first, ForwardIterator beyond, PointPMap point_pmap, NormalPMap normal_pmap, const Kernel &)
 Saves the [first, beyond) range of points (positions + normals) to a .xyz ASCII stream. More...
 
template<typename ForwardIterator , typename PointPMap , typename Kernel >
bool CGAL::write_xyz_points (std::ostream &stream, ForwardIterator first, ForwardIterator beyond, PointPMap point_pmap, const Kernel &)
 Saves the [first, beyond) range of points (positions only) to a .xyz ASCII stream. More...
 
template<typename ForwardIterator , typename PointPMap , typename NormalPMap , typename Kernel >
bool CGAL::write_off_points_and_normals (std::ostream &stream, ForwardIterator first, ForwardIterator beyond, PointPMap point_pmap, NormalPMap normal_pmap, const Kernel &)
 Saves the [first, beyond) range of points (positions + normals) to a .off ASCII stream. More...
 
template<typename ForwardIterator , typename PointPMap , typename Kernel >
bool CGAL::write_off_points (std::ostream &stream, ForwardIterator first, ForwardIterator beyond, PointPMap point_pmap, const Kernel &)
 Saves the [first, beyond) range of points (positions only) to a .off ASCII stream. More...
 
template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap , typename NormalPMap , typename Kernel >
bool CGAL::read_xyz_points_and_normals (std::istream &stream, OutputIterator output, PointPMap point_pmap, NormalPMap normal_pmap, const Kernel &)
 Reads points (positions + normals, if available) from a .xyz ASCII stream. More...
 
template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap , typename Kernel >
bool CGAL::read_xyz_points (std::istream &stream, OutputIterator output, PointPMap point_pmap, const Kernel &kernel)
 Reads points (positions only) from a .xyz ASCII stream. More...
 

Function Documentation

template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap , typename Kernel >
bool CGAL::read_off_points ( std::istream &  stream,
OutputIterator  output,
PointPMap  point_pmap,
const Kernel kernel 
)

Reads points (position only) from a .off ASCII stream.

The function expects for each point a line with the x y z position. If the position is followed by the nx ny nz normal, then the normal will be ignored. 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 Point_3<Kernel>. It can be omitted if the value type of OutputIterator is convertible to Point_3<Kernel>.
KernelGeometric traits class. It can be omitted and deduced automatically from the value type of PointPMap.
Returns
true on success.
Parameters
streaminput stream.
outputoutput iterator over points.
point_pmapproperty map: value_type of OutputIterator -> Point_3.
kernelgeometric traits.

#include <CGAL/IO/read_off_points.h>

Examples:
Point_set_processing_3/edges_example.cpp.
template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap , typename NormalPMap , typename Kernel >
bool CGAL::read_off_points_and_normals ( std::istream &  stream,
OutputIterator  output,
PointPMap  point_pmap,
NormalPMap  normal_pmap,
const Kernel  
)

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.
PointPMapis a model of WritablePropertyMap with value type Point_3<Kernel>. It can be omitted if the value type of OutputIterator is convertible to Point_3<Kernel>.
NormalPMapis a model of WritablePropertyMap with value type Vector_3<Kernel>.
KernelGeometric traits class. It can be omitted and deduced automatically from the value type of PointPMap.
Returns
true on success.
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_off_points.h>

template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap , typename Kernel >
bool CGAL::read_xyz_points ( std::istream &  stream,
OutputIterator  output,
PointPMap  point_pmap,
const Kernel kernel 
)

Reads points (positions only) from a .xyz ASCII stream.

The function expects for each point a line with the x y z position. If the position is followed by the nx ny nz normal, then the normal will be ignored. 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.
PointPMapis a model of WritablePropertyMap with value type Point_3<Kernel>. It can be omitted if the value type of OutputIterator is convertible to Point_3<Kernel>.
KernelGeometric traits class. It can be omitted and deduced automatically from the value type of PointPMap.
Returns
true on success.
Parameters
streaminput stream.
outputoutput iterator over points.
point_pmapproperty map: value_type of OutputIterator -> Point_3.
kernelgeometric traits.

#include <CGAL/IO/read_xyz_points.h>

Examples:
Point_set_processing_3/average_spacing_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/remove_outliers_example.cpp, Point_set_processing_3/scale_estimation_example.cpp, and Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp.
template<typename OutputIteratorValueType , typename OutputIterator , typename PointPMap , typename NormalPMap , typename Kernel >
bool CGAL::read_xyz_points_and_normals ( std::istream &  stream,
OutputIterator  output,
PointPMap  point_pmap,
NormalPMap  normal_pmap,
const Kernel  
)

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.
PointPMapis a model of WritablePropertyMap with value type Point_3<Kernel>. It can be omitted if the value type of OutputIterator value_type is convertible to Point_3<Kernel>.
NormalPMapis a model of WritablePropertyMap with value type Vector_3<Kernel>.
KernelGeometric traits class. It can be omitted and deduced automatically from the value type of PointPMap.
Returns
true on success.
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_xyz_points.h>

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/read_write_xyz_point_set_example.cpp, and Point_set_processing_3/structuring_example.cpp.
template<typename ForwardIterator , typename PointPMap , typename Kernel >
bool CGAL::write_off_points ( std::ostream &  stream,
ForwardIterator  first,
ForwardIterator  beyond,
PointPMap  point_pmap,
const Kernel  
)

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

The function writes for each point a line with the x y z position.

Template Parameters
ForwardIteratoriterator over input points.
PointPMapis a model of ReadablePropertyMap with a value_type = Point_3<Kernel>. It can be omitted if the value type of ForwardIterator is convertible to Point_3<Kernel>.
KernelGeometric traits class. It can be omitted and deduced automatically from the value type of PointPMap.
Returns
true on success.
Parameters
streamoutput stream.
firstiterator over the first input point.
beyondpast-the-end iterator over the input points.
point_pmapproperty map: value_type of ForwardIterator -> Point_3.

#include <CGAL/IO/write_off_points.h>

template<typename ForwardIterator , typename PointPMap , typename NormalPMap , typename Kernel >
bool CGAL::write_off_points_and_normals ( std::ostream &  stream,
ForwardIterator  first,
ForwardIterator  beyond,
PointPMap  point_pmap,
NormalPMap  normal_pmap,
const Kernel  
)

Saves the [first, beyond) range of points (positions + normals) 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.

Precondition
normals must be unit vectors
Template Parameters
ForwardIteratoriterator over input points.
PointPMapis a model of ReadablePropertyMap with value type Point_3<Kernel>. It can be omitted if the value type of ForwardIterator is convertible to Point_3<Kernel>.
NormalPMapis a model of ReadablePropertyMap with a value type Vector_3<Kernel>.
KernelGeometric traits class. It can be omitted and deduced automatically from the value type of PointPMap.
Returns
true on success.
Parameters
streamoutput stream.
firstiterator over the first input point.
beyondpast-the-end iterator over the input points.
point_pmapproperty map: value_type of ForwardIterator -> Point_3.
normal_pmapproperty map: value_type of ForwardIterator -> Vector_3.

#include <CGAL/IO/write_off_points.h>

template<typename ForwardIterator , typename PointPMap , typename Kernel >
bool CGAL::write_xyz_points ( std::ostream &  stream,
ForwardIterator  first,
ForwardIterator  beyond,
PointPMap  point_pmap,
const Kernel  
)

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

The function writes for each point a line with the x y z position.

Template Parameters
ForwardIteratoriterator over input points.
PointPMapis a model of ReadablePropertyMap with value type Point_3<Kernel>. It can be omitted if the value type of ForwardIterator value_type is convertible toPoint_3<Kernel>`.
KernelGeometric traits class. It can be omitted and deduced automatically from the value type of PointPMap.
Returns
true on success.
Parameters
streamoutput stream.
firstiterator over the first input point.
beyondpast-the-end iterator over the input points.
point_pmapproperty map: value_type of ForwardIterator -> Point_3.

#include <CGAL/IO/write_xyz_points.h>

Examples:
Point_set_processing_3/hierarchy_simplification_example.cpp, and Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp.
template<typename ForwardIterator , typename PointPMap , typename NormalPMap , typename Kernel >
bool CGAL::write_xyz_points_and_normals ( std::ostream &  stream,
ForwardIterator  first,
ForwardIterator  beyond,
PointPMap  point_pmap,
NormalPMap  normal_pmap,
const Kernel  
)

Saves the [first, beyond) range of points (positions + normals) 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.

Precondition
normals must be unit vectors
Template Parameters
ForwardIteratoriterator over input points.
PointPMapis a model of ReadablePropertyMap with a value type = Point_3<Kernel>. It can be omitted if the value type of ForwardIterator is convertible to Point_3<Kernel>.
NormalPMapis a model of ReadablePropertyMap with a value type Vector_3<Kernel>.
KernelGeometric traits class. It can be omitted and deduced automatically from the value type of PointPMap.
Returns
true on success.
Parameters
streamoutput stream.
firstiterator over the first input point.
beyondpast-the-end iterator over the input points.
point_pmapproperty map: value_type of ForwardIterator -> Point_3.
normal_pmapproperty map: value_type of ForwardIterator -> Vector_3.

#include <CGAL/IO/write_xyz_points.h>

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/read_write_xyz_point_set_example.cpp, and Point_set_processing_3/structuring_example.cpp.