Easy3D 2.6.1
|
A data structure for point clouds. More...
#include <easy3d/core/point_cloud.h>
Classes | |
class | BaseHandle |
Base class for topology types (internally it is basically an index). More... | |
class | ModelProperty |
Cloud property of type T. More... | |
class | Vertex |
This type represents a vertex (internally it is basically an index). More... | |
class | VertexContainer |
This helper class is a container for iterating through all vertices using C++11 range-based for-loops. More... | |
class | VertexIterator |
This class iterates linearly over all vertices. More... | |
class | VertexProperty |
Vertex property of type T. More... | |
Public Member Functions | |
Construct, destruct, assignment | |
PointCloud () | |
Default constructor. | |
~PointCloud () override=default | |
Destructor (is virtual, since we inherit from Model). | |
PointCloud (const PointCloud &rhs) | |
Copy constructor: copies rhs to *this . Performs a deep copy of all properties. | |
PointCloud & | operator= (const PointCloud &rhs) |
Assign rhs to *this . Performs a deep copy of all properties. | |
PointCloud & | operator+= (const PointCloud &other) |
Merges another point cloud into the current one. | |
PointCloud & | join (const PointCloud &other) |
Merges another point cloud into the current one. | |
PointCloud & | assign (const PointCloud &rhs) |
Assign rhs to *this . Does not copy custom properties. | |
Add new elements by hand | |
Vertex | add_vertex (const vec3 &p) |
Add a new vertex with position p . | |
Memory Management | |
unsigned int | vertices_size () const |
Returns number of (deleted and valid) vertices in the cloud. | |
unsigned int | n_vertices () const |
Returns number of vertices in the cloud. | |
void | clear () |
Clear cloud: remove all vertices. | |
void | resize (unsigned int nv) |
Resize space for vertices and their currently associated properties. | |
bool | has_garbage () const |
Are there deleted vertices? | |
void | collect_garbage () |
Remove deleted vertices. | |
void | delete_vertex (Vertex v) |
Deletes the vertex v from the cloud. | |
bool | is_deleted (Vertex v) const |
Returns whether vertex v is deleted. | |
bool | is_valid (Vertex v) const |
Return whether vertex v is valid, i.e. the index is stores it within the array bounds. | |
Property handling | |
template<class T> | |
VertexProperty< T > | add_vertex_property (const std::string &name, const T t=T()) |
Add a vertex property of type T with name name and default value t . | |
template<class T> | |
ModelProperty< T > | add_model_property (const std::string &name, const T t=T()) |
Add a vertex property of type T with name name and default value t . | |
template<class T> | |
VertexProperty< T > | get_vertex_property (const std::string &name) const |
Get the vertex property named name of type T . | |
template<class T> | |
ModelProperty< T > | get_model_property (const std::string &name) const |
Gets the model property named name of type T . | |
template<class T> | |
VertexProperty< T > | vertex_property (const std::string &name, const T t=T()) |
Gets or adds a vertex property of type T with name name . | |
template<class T> | |
ModelProperty< T > | model_property (const std::string &name, const T t=T()) |
Gets or adds a model property of type T with name name . | |
template<class T> | |
bool | remove_vertex_property (VertexProperty< T > &p) |
Remove the vertex property p . | |
bool | remove_vertex_property (const std::string &n) |
Remove the vertex property named n . | |
template<class T> | |
bool | remove_model_property (ModelProperty< T > &p) |
Remove the model property p . | |
bool | remove_model_property (const std::string &n) |
Remove the model property named n . | |
bool | rename_vertex_property (const std::string &old_name, const std::string &new_name) |
Rename a vertex property given its name. | |
bool | rename_model_property (const std::string &old_name, const std::string &new_name) |
Rename a model property given its name. | |
const std::type_info & | get_vertex_property_type (const std::string &name) const |
Get the type_info T of vertex property name . | |
const std::type_info & | get_model_property_type (const std::string &name) const |
Get the type_info T of model property name . | |
std::vector< std::string > | vertex_properties () const |
Returns the names of all vertex properties. | |
std::vector< std::string > | model_properties () const |
Returns the names of all model properties. | |
void | property_stats (std::ostream &output) const override |
Prints the names of all properties to an output stream (e.g., std::cout). | |
Iterators | |
VertexIterator | vertices_begin () const |
Returns start iterator for vertices. | |
VertexIterator | vertices_end () const |
Returns end iterator for vertices. | |
VertexContainer | vertices () const |
Returns vertex container for C++11 range-based for-loops. | |
![]() | |
Model (const std::string &name="unknown") | |
Default constructor. The parameter name is optional, but it is useful for handling multiple models with the same viewer. | |
void | set_name (const std::string &n) |
Sets/Changes the name of a model. Assigning a name to a model is optional, but it is useful for handling multiple models with the same viewer. | |
const std::string & | name () const |
The name of a model. | |
const Box3 & | bounding_box (bool recompute=false) const |
The bounding box of the model. | |
void | invalidate_bounding_box () |
Invalidates the bounding box of the model. So when bounding_box() is called, the bounding box will be re-computed. This function is typically called when the geometry of a model is changed. | |
bool | empty () const |
Tests if the model is empty. | |
void | set_renderer (std::shared_ptr< Renderer > r) |
Sets the renderer of this model. | |
Renderer * | renderer () |
Gets the renderer of this model. | |
const Renderer * | renderer () const |
Gets the constant renderer of this model. | |
void | set_manipulator (std::shared_ptr< Manipulator > manip) |
Attaches a manipulator to this model. | |
Manipulator * | manipulator () |
Gets the manipulator attached to this model. | |
const Manipulator * | manipulator () const |
Gets the manipulator attached to this model. | |
Geometry-related Functions | |
const vec3 & | position (Vertex v) const |
Gets the position of a vertex (read only). | |
vec3 & | position (Vertex v) |
Gets the position of a vertex. | |
const std::vector< vec3 > & | points () const override |
Returns the vector of vertex positions (read only). | |
std::vector< vec3 > & | points () override |
Returns the vector of vertex positions. | |
A data structure for point clouds.
This implementation is inspired by Surface_mesh https://opensource.cit-ec.de/projects/surface_mesh
|
inline |
Copy constructor: copies rhs
to *this
. Performs a deep copy of all properties.
rhs | The other point cloud. |
|
inline |
Add a vertex property of type T
with name name
and default value t
.
name | The name of the property. |
t | The default value of the property. |
PointCloud::Vertex add_vertex | ( | const vec3 & | p | ) |
Add a new vertex with position p
.
p | The position of the new vertex. |
|
inline |
Add a vertex property of type T
with name name
and default value t
.
name | The name of the property. |
t | The default value of the property. |
PointCloud & assign | ( | const PointCloud & | rhs | ) |
Assign rhs
to *this
. Does not copy custom properties.
rhs | The other point cloud. |
void collect_garbage | ( | ) |
Remove deleted vertices.
void delete_vertex | ( | Vertex | v | ) |
Deletes the vertex v
from the cloud.
v | The vertex to delete. |
|
inline |
Gets the model property named name
of type T
.
name | The name of the property. |
|
inline |
Get the type_info T
of model property name
.
name | The name of the property. |
|
inline |
Get the vertex property named name
of type T
.
name | The name of the property. |
|
inline |
Get the type_info T
of vertex property name
.
name | The name of the property. |
|
inline |
Are there deleted vertices?
|
inline |
Returns whether vertex v
is deleted.
v | The vertex to check. |
|
inline |
Return whether vertex v
is valid, i.e. the index is stores it within the array bounds.
v | The vertex to check. |
PointCloud & join | ( | const PointCloud & | other | ) |
Merges another point cloud into the current one.
Shifts the indices of vertices of the other point cloud by number_of_vertices() + number_of_removed_vertices()
. Copies entries of all property maps which have the same name in both point clouds. That is, property maps which are only in other
are ignored. Also copies elements which are marked as removed, and concatenates the freelists of both point clouds.
other | The other point cloud to merge. |
|
inline |
Returns the names of all model properties.
|
inline |
Gets or adds a model property of type T
with name name
.
name | The name of the property. |
t | The default value of the property. |
T
with name name
exists, it is returned. otherwise this property is added (with default value t
) and then returned.
|
inline |
Returns number of vertices in the cloud.
|
inline |
Merges another point cloud into the current one.
Shifts the indices of vertices of the other point cloud by number_of_vertices() + number_of_removed_vertices()
. Copies entries of all property maps which have the same name in both point clouds. That is, property maps which are only in other
are ignored. Also copies elements which are marked as removed, and concatenates the freelists of both point clouds.
other | The other point cloud to merge. |
PointCloud & operator= | ( | const PointCloud & | rhs | ) |
Assign rhs
to *this
. Performs a deep copy of all properties.
rhs | The other point cloud. |
|
inlineoverridevirtual |
Returns the vector of vertex positions (read only).
Implements Model.
|
inlineoverridevirtual |
Returns the vector of vertex positions.
Implements Model.
Gets the position of a vertex.
v | The vertex to get the position of. |
Gets the position of a vertex (read only).
v | The vertex to get the position of. |
|
overridevirtual |
Prints the names of all properties to an output stream (e.g., std::cout).
output | The output stream to print to. |
Reimplemented from Model.
|
inline |
Remove the model property named n
.
n | The name of the model property to remove. |
|
inline |
Remove the model property p
.
p | The model property to remove. |
|
inline |
Remove the vertex property named n
.
n | The name of the vertex property to remove. |
|
inline |
Remove the vertex property p
.
p | The vertex property to remove. |
|
inline |
Rename a model property given its name.
old_name | The old name of the property. |
new_name | The new name of the property. |
|
inline |
Rename a vertex property given its name.
old_name | The old name of the property. |
new_name | The new name of the property. |
|
inline |
Resize space for vertices and their currently associated properties.
nv | The new size for the vertices. |
|
inline |
Returns the names of all vertex properties.
|
inline |
Gets or adds a vertex property of type T
with name name
.
name | The name of the property. |
t | The default value of the property. |
T
with name name
exists, it is returned. otherwise this property is added (with default value t
) and then returned.
|
inline |
Returns vertex container for C++11 range-based for-loops.
|
inline |
Returns start iterator for vertices.
|
inline |
Returns end iterator for vertices.
|
inline |
Returns number of (deleted and valid) vertices in the cloud.