CGAL 5.5.2 - 3D Point Set

This module offers convenience overloads of input/ouput functions available in the Point Set Processing package.

These overloads, available after including CGAL/Point_set_3/IO.h, allow the user to call point set processing algorithms without having to handle manually property maps and iterators.

Input functions instanciate all the necessary property maps:

For a complete documentation of these functions, please refer to the Point Set Processing Reference manual.

Modules

 Input/Output (LAS)
 I/O Functions for the LAS (Lidar) File Format.
 
 Input/Output (OFF)
 I/O Functions for the Object File Format (OFF).
 
 Input/Output (PLY)
 I/O Functions for the Polygon File Format (PLY).
 
 Input/Output (XYZ)
 I/O Functions for the XYZ File Format.
 
 Input/Output (Deprecated)
 These I/O functions are deprecated and newer versions should be used.
 

Functions

template<typename Point , typename Vector , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_point_set (const std::string &fname, CGAL::Point_set_3< Point, Vector > &ps, const NamedParameters &np=parameters::default_values())
 reads the point set from an input file. More...
 
template<typename Point , typename Vector >
std::ostream & CGAL::operator<< (std::ostream &os, const CGAL::Point_set_3< Point, Vector > &ps)
 writes the point set in an output stream in the Polygon File Format (PLY). More...
 
template<typename Point , typename Vector , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_point_set (const std::string &fname, CGAL::Point_set_3< Point, Vector > &ps, const NamedParameters &np=parameters::default_values())
 writes the point set in an output file. More...
 
template<typename Point , typename Vector >
std::istream & operator>> (std::istream &is, CGAL::Point_set_3< Point, Vector > &ps)
 reads the point set from an input stream. More...
 

Function Documentation

◆ operator<<()

template<typename Point , typename Vector >
std::ostream& CGAL::operator<< ( std::ostream &  os,
const CGAL::Point_set_3< Point, Vector > &  ps 
)

#include <CGAL/Point_set_3/IO.h>

writes the point set in an output stream in the Polygon File Format (PLY).

All properties are inserted in their instantiation order.

Attention
To write to a binary file, the flag std::ios::binary must be set during the creation of the ofstream, and the IO::Mode of the stream must be set to BINARY.
Parameters
osthe output stream
psthe point set
Returns
os

◆ operator>>()

template<typename Point , typename Vector >
std::istream & operator>> ( std::istream &  is,
CGAL::Point_set_3< Point, Vector > &  ps 
)
related

reads the point set from an input stream.

Supported file formats are the following:

The format is detected from the stream. If the stream contains normal vectors, the normal map is added to the point set. For PLY input, all point properties found in the header are added.

Attention
To read a binary file, the flag std::ios::binary must be set during the creation of the ifstream.
Parameters
isinput stream
pspoint set
Returns
is

◆ read_point_set()

template<typename Point , typename Vector , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_point_set ( const std::string &  fname,
CGAL::Point_set_3< Point, Vector > &  ps,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Point_set_3/IO.h>

reads the point set from an input file.

Supported file formats are the following:

The format is detected from the filename extension (letter case is not important). If the file contains normal vectors, the normal map is added to the point set. For PLY input, all point properties found in the header are added.

Template Parameters
Pointthe point type of the Point_set_3
Vectorthe vector type of the Point_set_3
NamedParametersa sequence of Named Parameters
Parameters
fnamename of the input file
psthe point set
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • indicates whether data should be read in binary (true) or in ASCII (false)
  • Type: Boolean
  • Default: true
  • Extra: This parameter is only relevant for PLY writing: the OFF and XYZ formats are always ASCII, and the LAS format is always binary.
Returns
true if the reading was successful, false otherwise.
Examples:
Point_set_3/draw_point_set_3.cpp.

◆ write_point_set()

template<typename Point , typename Vector , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_point_set ( const std::string &  fname,
CGAL::Point_set_3< Point, Vector > &  ps,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Point_set_3/IO.h>

writes the point set in an output file.

Supported file formats are the following:

The format is detected from the filename extension (letter case is not important).

Template Parameters
Pointthe point type of the Point_set_3
Vectorthe vector type of the Point_set_3
NamedParametersa sequence of Named Parameters
Parameters
fnamename of the output file
psthe point set
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • indicates whether data should be written in binary (true) or in ASCII (false)
  • Type: Boolean
  • Default: true
  • Extra: This parameter is only relevant for PLY writing: the OFF and XYZ formats are always ASCII, and the LAS format is always binary.

  • a parameter used to set the precision (i.e. how many digits are generated) of the output stream
  • Type: int
  • Default: 6
Returns
true if the writing was successful, false otherwise.