CGAL 5.3.2 - 3D Point Set
|
#include <CGAL/Point_set_3/IO/XYZ.h>
A collection of points with dynamically associated properties.
An instance of this class stores a set of indices of type Index
, each representing a point. Properties can be associated to each point and can be retrieved using the index of the point. There are two particular properties that are hard coded by this class: the coordinates of the points and the normal vectors.
The coordinates of a point can be access using the index of the point and the member function point()
. This property is always present. The normal vector of a point can be accessed using the index of the point and the normal()
method. This property must be explicitly created.
All properties can be accessed as a range using the methods points()
, normals()
, and range()
for points coordinates, normal vectors, and other properties respectively.
Removing a point with properties is achieved by moving its Index
at the end of the container and keeping track of the number of removed elements. A garbage collection method must be called to really remove it from memory.
For convenience, all functions of the package Point Set Processing automatically creates the right named parameters if called with a CGAL::Point_set_3
object as argument.
Point | Point type |
Vector | Normal vector type |
Classes | |
class | Index |
This represents a point with associated properties. More... | |
Public Types | |
typedef Point | Point_3 |
The point type. | |
typedef Vector | Vector_3 |
The vector type. | |
typedef unspecified_type | iterator |
Iterator type of the point set with value type Index More... | |
typedef unspecified_type | const_iterator |
Constant iterator type of the point set with value type Index More... | |
typedef Property_map< Point > | Point_map |
Property map of points. | |
typedef Property_map< Vector > | Vector_map |
Property map of vectors. | |
typedef Property_range< Point > | Point_range |
Constant range of points. | |
typedef Property_range< Vector > | Vector_range |
Constant range of vectors. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Point , typename Vector > | |
Point_set_3< Point, Vector > & | operator+= (Point_set_3< Point, Vector > &ps, Point_set_3< Point, Vector > &other) |
Append other at the end of ps . 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... | |
Construction, Destruction, Assignment | |
Point_set_3 (bool with_normal_map=false) | |
creates an empty point set with no additional property. More... | |
Point_set_3 & | operator= (const Point_set_3 &ps) |
Assignment operator, all properties with their content are copied. | |
Memory Management | |
bool | is_empty () const |
returns true if the number of elements not marked as removed is 0, false otherwise. More... | |
std::size_t | number_of_points () const |
returns the number of elements (not counting elements marked as removed). More... | |
bool | join (Point_set_3 &other) |
merges other in the point set. More... | |
void | clear () |
Clears the point set properties and content. More... | |
void | clear_properties () |
Clears all properties created. More... | |
void | reserve (std::size_t s) |
increases the capacity of internal containers to be able to efficiently accommodate at least s elements More... | |
void | resize (std::size_t s) |
changes size of the point set. More... | |
Adding Points and Normals | |
iterator | insert () |
inserts a new element with default property values. More... | |
iterator | insert (const Point &p) |
inserts new point with default property values. More... | |
iterator | insert (const Point &p, const Vector &n) |
Convenience method to add a point with a normal vector. More... | |
iterator | insert (const Point_set_3 &other, const Index &idx) |
Convenience method to copy a point with all its properties from another point set. More... | |
Accessors and Iterators | |
iterator | begin () |
returns the begin iterator. | |
iterator | end () |
returns the past-the-end iterator. More... | |
const_iterator | begin () const |
returns the begin constant iterator. | |
const_iterator | end () const |
returns the past-the-end constant iterator. More... | |
Point & | point (const Index &index) |
returns a reference to the point corresponding to index . | |
const Point & | point (const Index &index) const |
returns a constant reference to the point corresponding to index . | |
Vector & | normal (const Index &index) |
returns a reference to the normal corresponding to index . More... | |
const Vector & | normal (const Index &index) const |
returns a constant reference to the normal corresponding to index . More... | |
Removal Methods | |
void | remove (iterator first, iterator last) |
marks all elements between first and last as removed. More... | |
void | remove (iterator it) |
marks element specified by iterator as removed. More... | |
void | remove (const Index &index) |
marks element specified by Index as removed. More... | |
Garbage Management | |
bool | is_removed (const_iterator it) const |
returns true if the element is marked as removed, false otherwise. More... | |
bool | is_removed (const Index &index) const |
returns true if the element is marked as removed, false otherwise. More... | |
const_iterator | garbage_begin () const |
returns the constant iterator to the first element marked as removed (equal to garbage_end() if no elements are marked as removed. | |
const_iterator | garbage_end () const |
returns the past-the-end constant iterator of the elements marked as removed. | |
std::size_t | number_of_removed_points () const |
Number of removed points. More... | |
std::size_t | garbage_size () const |
Number of removed points. More... | |
bool | has_garbage () const |
returns true if there are elements marked as removed, false otherwise. | |
void | collect_garbage () |
erases from memory the elements marked as removed. | |
void | cancel_removals () |
restores all removed points. More... | |
Property Handling | |
A property Properties can be added, looked up with a string and removed at runtime. | |
template<class Type > | |
using | Property_map = unspecified_type |
Model of LvaluePropertyMap with Index as a key type and Type as value type. More... | |
template<typename T > | |
bool | has_property_map (const std::string &name) const |
tests whether property name of type T already exists. More... | |
template<class T > | |
std::pair< Property_map< T >, bool > | add_property_map (const std::string &name, const T t=T()) |
adds a new property name of type T with given default value. More... | |
template<class T > | |
std::pair< Property_map< T >, bool > | property_map (const std::string &name) const |
returns the property name of type T . More... | |
template<class T > | |
bool | remove_property_map (Property_map< T > &prop) |
removes the specified property. More... | |
bool | has_normal_map () const |
Convenience method that tests whether the point set has normals. More... | |
std::pair< Vector_map, bool > | add_normal_map (const Vector &default_value=CGAL::NULL_VECTOR) |
Convenience method that adds a normal property. More... | |
Vector_map | normal_map () |
returns the property map of the normal property. More... | |
const Vector_map | normal_map () const |
returns the property map of the normal property (constant version). More... | |
bool | remove_normal_map () |
Convenience method that removes the normal property. More... | |
Point_map | point_map () |
returns the property map of the point property. | |
const Point_map | point_map () const |
returns the property map of the point property (constant version). | |
void | copy_properties (const Point_set_3 &other) |
Copies the properties from another point set. More... | |
std::vector< std::string > | properties () const |
returns a vector with all strings that describe properties. | |
std::vector< std::pair< std::string, std::type_index > > | properties_and_types () const |
returns a vector of pairs that describe properties and associated types. | |
unspecified_type | parameters () const |
returns a sequence of Named Parameters to be used in Point Set Processing algorithms. More... | |
Ranges | |
template<class Type > | |
using | Property_range = unspecified_type |
Model of ConstRange that handles constant ranges for property maps with value type Type . More... | |
template<class T > | |
Property_range< T > | range (const Property_map< T > &pmap) const |
returns a property as a range. | |
Point_range | points () const |
returns a constant range of points. | |
Vector_range | normals () const |
returns a constant range of normals. | |
Push Property Maps and Inserters (Advanced) | |
Advanced
The following method are specifically designed to make
| |
template<class Property > | |
using | Property_back_inserter = unspecified_type |
This is an advanced type. More... | |
template<class Property > | |
using | Push_property_map = unspecified_type |
This is an advanced type. More... | |
typedef Property_back_inserter< Index_map > | Index_back_inserter |
This is an advanced type. More... | |
typedef Property_back_inserter< Point_map > | Point_back_inserter |
This is an advanced type. More... | |
typedef Push_property_map< Point_map > | Point_push_map |
This is an advanced type. More... | |
typedef Push_property_map< Vector_map > | Vector_push_map |
This is an advanced type. More... | |
template<class T > | |
Push_property_map< Property_map< T > > | push_property_map (Property_map< T > &prop) |
This is an advanced function. More... | |
Point_push_map | point_push_map () |
This is an advanced function. More... | |
Vector_push_map | normal_push_map () |
This is an advanced function. More... | |
Index_back_inserter | index_back_inserter () |
This is an advanced function. More... | |
Point_back_inserter | point_back_inserter () |
This is an advanced function. More... | |
typedef unspecified_type CGAL::Point_set_3< Point, Vector >::const_iterator |
Constant iterator type of the point set with value type Index
typedef Property_back_inserter<Index_map> CGAL::Point_set_3< Point, Vector >::Index_back_inserter |
This is an advanced type.
Back inserter on indices
typedef unspecified_type CGAL::Point_set_3< Point, Vector >::iterator |
typedef Property_back_inserter<Point_map> CGAL::Point_set_3< Point, Vector >::Point_back_inserter |
This is an advanced type.
Back inserter on points
typedef Push_property_map<Point_map> CGAL::Point_set_3< Point, Vector >::Point_push_map |
This is an advanced type.
Property map for pushing new points
using CGAL::Point_set_3< Point, Vector >::Property_back_inserter = unspecified_type |
This is an advanced type.
Model of OutputIterator
used to insert elements by defining the value of the property Property
.
using CGAL::Point_set_3< Point, Vector >::Property_map = unspecified_type |
Model of LvaluePropertyMap
with Index
as a key type and Type
as value type.
using CGAL::Point_set_3< Point, Vector >::Property_range = unspecified_type |
Model of ConstRange
that handles constant ranges for property maps with value type Type
.
using CGAL::Point_set_3< Point, Vector >::Push_property_map = unspecified_type |
This is an advanced type.
Model of WritablePropertyMap
based on Property
and that is allowed to push new items to the point set if needed.
typedef Push_property_map<Vector_map> CGAL::Point_set_3< Point, Vector >::Vector_push_map |
This is an advanced type.
Property map for pushing new vectors
CGAL::Point_set_3< Point, Vector >::Point_set_3 | ( | bool | with_normal_map = false | ) |
creates an empty point set with no additional property.
with_normal_map | true if the normal map should be added. If false (default value), the normal map can still be added later on (see add_normal_map() ). |
std::pair<Vector_map, bool> CGAL::Point_set_3< Point, Vector >::add_normal_map | ( | const Vector & | default_value = CGAL::NULL_VECTOR | ) |
Convenience method that adds a normal property.
This method adds a property of type Vector
and named normal
.
true
if the property was added and false
if it already exists (and was therefore not added but only returned). std::pair<Property_map<T>, bool> CGAL::Point_set_3< Point, Vector >::add_property_map | ( | const std::string & | name, |
const T | t = T() |
||
) |
adds a new property name
of type T
with given default value.
T | type of the property. |
name | Name of the property. |
t | Value taken by the property on already created elements. |
true
if the property was added and false
if it already exists (and was therefore not added but only returned). void CGAL::Point_set_3< Point, Vector >::cancel_removals | ( | ) |
restores all removed points.
After removing one or several points, calling this method restores the point set to its initial state: points that were removed (and their associated properties) are restored.
collect_garbage()
was called after removal, the points are irremediably lost and nothing will be restored. void CGAL::Point_set_3< Point, Vector >::clear | ( | ) |
Clears the point set properties and content.
After calling this method, the object is the same as a newly constructed object. The additional properties (such as normal vectors) are also removed and must thus be re-added if needed.
void CGAL::Point_set_3< Point, Vector >::clear_properties | ( | ) |
Clears all properties created.
After calling this method, all properties are removed. The points are left unchanged.
void CGAL::Point_set_3< Point, Vector >::copy_properties | ( | const Point_set_3< Point, Vector > & | other | ) |
Copies the properties from another point set.
All properties from other
that do not already exist in this point set are added and filled to their default values. Properties that exist in both point sets are left unchanged.
iterator CGAL::Point_set_3< Point, Vector >::end | ( | ) |
returns the past-the-end iterator.
garbage_begin()
. const_iterator CGAL::Point_set_3< Point, Vector >::end | ( | ) | const |
returns the past-the-end constant iterator.
garbage_begin()
. std::size_t CGAL::Point_set_3< Point, Vector >::garbage_size | ( | ) | const |
Number of removed points.
number_of_removed_points()
bool CGAL::Point_set_3< Point, Vector >::has_normal_map | ( | ) | const |
Convenience method that tests whether the point set has normals.
This method tests whether a property of type Vector
and named normal
exists.
bool CGAL::Point_set_3< Point, Vector >::has_property_map | ( | const std::string & | name | ) | const |
tests whether property name
of type T
already exists.
T | type of the property. |
name | Name of the property. |
Index_back_inserter CGAL::Point_set_3< Point, Vector >::index_back_inserter | ( | ) |
This is an advanced function.
returns the back inserter on the index property.
iterator CGAL::Point_set_3< Point, Vector >::insert | ( | ) |
inserts a new element with default property values.
iterator CGAL::Point_set_3< Point, Vector >::insert | ( | const Point & | p | ) |
inserts new point with default property values.
p | Point to insert |
iterator CGAL::Point_set_3< Point, Vector >::insert | ( | const Point & | p, |
const Vector & | n | ||
) |
Convenience method to add a point with a normal vector.
p | Point to insert |
n | Associated normal vector |
iterator CGAL::Point_set_3< Point, Vector >::insert | ( | const Point_set_3< Point, Vector > & | other, |
const Index & | idx | ||
) |
Convenience method to copy a point with all its properties from another point set.
In the case where two point sets have the same properties, this method allows the user to easily copy one point (along with the values of all its properties) from one point set to another.
other | Point set to which the point to copy belongs |
idx | Index of the point to copy in other |
other
must have the exact same properties, with the exact same names and types in the exact same order.bool CGAL::Point_set_3< Point, Vector >::is_empty | ( | ) | const |
returns true
if the number of elements not marked as removed is 0, false
otherwise.
empty()
is also available (see Range
) and does the same thing. bool CGAL::Point_set_3< Point, Vector >::is_removed | ( | const_iterator | it | ) | const |
bool CGAL::Point_set_3< Point, Vector >::is_removed | ( | const Index & | index | ) | const |
bool CGAL::Point_set_3< Point, Vector >::join | ( | Point_set_3< Point, Vector > & | other | ) |
merges other
in the point set.
Shifts the indices of points of other
by number_of_points() + other.number_of_points()
.
Copies entries of all property maps which have the same name in the point set and other
. Property maps which are only in other
are ignored.
copy_properties()
with other
as argument is called before calling this method, then all the content of other
will be copied and no property will be lost in the process.Vector& CGAL::Point_set_3< Point, Vector >::normal | ( | const Index & | index | ) |
returns a reference to the normal corresponding to index
.
add_normal_map()
). const Vector& CGAL::Point_set_3< Point, Vector >::normal | ( | const Index & | index | ) | const |
returns a constant reference to the normal corresponding to index
.
add_normal_map()
). Vector_map CGAL::Point_set_3< Point, Vector >::normal_map | ( | ) |
returns the property map of the normal property.
add_normal_map()
). const Vector_map CGAL::Point_set_3< Point, Vector >::normal_map | ( | ) | const |
returns the property map of the normal property (constant version).
add_normal_map()
). Vector_push_map CGAL::Point_set_3< Point, Vector >::normal_push_map | ( | ) |
This is an advanced function.
returns the push property map of the normal property.
add_normal_map()
). std::size_t CGAL::Point_set_3< Point, Vector >::number_of_points | ( | ) | const |
returns the number of elements (not counting elements marked as removed).
number_of_removed_points()
for getting the number of elements marked as removed.size()
is also available (see Range
) and does the same thing. std::size_t CGAL::Point_set_3< Point, Vector >::number_of_removed_points | ( | ) | const |
Number of removed points.
garbage_size()
unspecified_type CGAL::Point_set_3< Point, Vector >::parameters | ( | ) | const |
returns a sequence of Named Parameters to be used in Point Set Processing algorithms.
The following named parameters are used:
point_map
: contains the point property map (see point_map()
)normal_map
: contains the normal map (see normal_map()
)geom_traits
: contains the kernel typename Kernel_traits<Point>
::Kernel
Point_back_inserter CGAL::Point_set_3< Point, Vector >::point_back_inserter | ( | ) |
This is an advanced function.
returns the back inserter on the point property.
Point_push_map CGAL::Point_set_3< Point, Vector >::point_push_map | ( | ) |
This is an advanced function.
returns the push property map of the point property.
std::pair<Property_map<T>,bool> CGAL::Point_set_3< Point, Vector >::property_map | ( | const std::string & | name | ) | const |
returns the property name
of type T
.
T | type of the property. |
name | Name of the property. |
true
or an empty property map and a Boolean set to false
(if the property was not found). Push_property_map<Property_map<T> > CGAL::Point_set_3< Point, Vector >::push_property_map | ( | Property_map< T > & | prop | ) |
This is an advanced function.
returns the push property map of the given property.
T | type of the property. |
prop | The property map. |
true
or an empty property map and a Boolean set to false
(if the property was not found). void CGAL::Point_set_3< Point, Vector >::remove | ( | iterator | first, |
iterator | last | ||
) |
marks all elements between first
and last
as removed.
collect_garbage()
should be called if the memory needs to be disallocated. Elements can be recovered with cancel_removals()
.void CGAL::Point_set_3< Point, Vector >::remove | ( | iterator | it | ) |
marks element specified by iterator as removed.
collect_garbage()
should be called if the memory needs to be freed. The element can be recovered with cancel_removals()
.end()
iterator is invalidated, it
dereferences to a different element. void CGAL::Point_set_3< Point, Vector >::remove | ( | const Index & | index | ) |
marks element specified by Index
as removed.
collect_garbage()
should be called if the memory needs to be freed. The element can be recovered with cancel_removals()
.end()
iterator is invalidated, it
dereferences to a different element. bool CGAL::Point_set_3< Point, Vector >::remove_normal_map | ( | ) |
Convenience method that removes the normal property.
true
if the property was removed and false
if the property was not found. bool CGAL::Point_set_3< Point, Vector >::remove_property_map | ( | Property_map< T > & | prop | ) |
removes the specified property.
T | type of the property. |
prop | The property. |
true
if the property was removed and false
if the property was not found. void CGAL::Point_set_3< Point, Vector >::reserve | ( | std::size_t | s | ) |
increases the capacity of internal containers to be able to efficiently accommodate at least s
elements
s | Expected final number of elements. |
void CGAL::Point_set_3< Point, Vector >::resize | ( | std::size_t | s | ) |
changes size of the point set.
s | Target size of the point set |
|
related |
Append other
at the end of ps
.
Shifts the indices of points of other
by ps.number_of_points() + other.number_of_points()
.
Copies entries of all property maps which have the same name in ps
and other
. Property maps which are only in other
are ignored.