Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
Cloud Class Reference

A wrapper which allows to use any implementation of cloud provided by a third-party library. More...

#include <cloud.h>

Inheritance diagram for Cloud:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void append (const Point3D &point)
 Appends a new 3D point to the cloud.
void append (const Cloud &cloud)
 Appends the points of the passed cloud to this cloud.
void clear ()
 Removes all points from the cloud and resets the object.
 Cloud ()
 Default Constructor.
 Cloud (const Cloud &copy)
 Copy Constructor.
 Cloud (const Cloud3D &cloud, bool register_stats=false)
 Construct a cloud from a Cloud3D.
void draw (bool disable_highlight=false) const
 Renders the cloud and highlights any selected points.
void drawWithHighlightColor () const
 Renders the cloud with the color used for highlighting the selected points.
void drawWithPureColor () const
 Renders the cloud and highlights any selected points.
void drawWithRGB () const
 Renders the cloud and highlights any selected points.
void drawWithTexture () const
 Renders the cloud and highlights any selected points.
void getCenter (float &x, float &y, float &z) const
 Returns the center of the point cloud.
Point3D getDisplaySpacePoint (unsigned int index) const
 Compute the transformed coordinates of the indexed point in the cloud to match the display.
void getDisplaySpacePoints (std::vector< Point3D > &pts) const
 Compute the transformed coordinates of the all the points in the cloud to match the display.
const Cloud3DgetInternalCloud () const
 Returns a const reference to the internal representation of this object.
const float * getMatrix () const
 Gets the transform matrix.
Point3D getObjectSpacePoint (unsigned int index) const
 Compute the transformed coordinates of the indexed point in the cloud according to the object transform.
float getScalingFactor () const
 Returns the scaling factor for the point cloud.
std::string getStat () const
 Get statistics of the selected points in string.
void loadMatrix (const float *matrix)
 Sets the transform matrix for the cloud.
void multMatrix (const float *matrix)
 Right multiplies the cloud matrix with the passed matrix.
Cloudoperator= (const Cloud &cloud)
 Equal Operator.
Point3Doperator[] (unsigned int index)
 Subscript Operator.
const Point3Doperator[] (unsigned int index) const
 Subscript Operator.
void remove (const Selection &selection)
 Removes the points in selection from the cloud.
void resize (unsigned int new_size)
 Sets the size of the cloud of this object to the passed new size.
void restore (const CopyBuffer &copy_buffer, const Selection &selection)
 Places the points in the copy buffer into the cloud according to the indices in the selection.
void setColorRamp (bool on_off)
 Enables/Disables the use of the color ramp in display.
void setColorRampAxis (Axis a)
 Sets the axis along which the displyed points should have the color ramp applied.
void setHighlightColor (float r, float g, float b)
 Sets the RGB values used for highlighting the selected points.
void setHighlightPointSize (int size)
 Set the sizes used for rendering the selected points.
void setPointSize (int size)
 Set the sizes used for rendering the unselected points.
void setRGB (float r, float g, float b)
 Sets the RGB values for coloring points in COLOR_BY_PURE mode.
void setSelection (SelectionPtr selection_ptr)
 Sets the selected points.
void setSelectionRotation (const float *matrix)
 Sets the selection transform matrix to the one passed.
void setSelectionTranslation (float dx, float dy, float dz)
unsigned int size () const
 Gets the size of the cloud.
 ~Cloud ()
 Destructor.

Static Public Attributes

static const float DEFAULT_POINT_DISPLAY_COLOR_BLUE_ = 1.0f
 Default Point Color - Blue componenet.
static const float DEFAULT_POINT_DISPLAY_COLOR_GREEN_ = 1.0f
 Default Point Color - Green componenet.
static const float DEFAULT_POINT_DISPLAY_COLOR_RED_ = 1.0f
 Default Point Color - Red componenet.
static const float DEFAULT_POINT_DISPLAY_SIZE_ = 2.0f
 Default Point Size.
static const float DEFAULT_POINT_HIGHLIGHT_COLOR_BLUE_ = 0.0f
 Default Point Highlight Color - Blue componenet.
static const float DEFAULT_POINT_HIGHLIGHT_COLOR_GREEN_ = 1.0f
 Default Point Highlight Color - Green componenet.
static const float DEFAULT_POINT_HIGHLIGHT_COLOR_RED_ = 0.0f
 Default Point Highlight Color - Red componenet.
static const float DEFAULT_POINT_HIGHLIGHT_SIZE_ = 4.0f
 Default Highlight Point Size.

Private Member Functions

void disableTexture () const
 Disable the texture used for rendering the cloud.
void enableTexture () const
 Enable the texture used for rendering the cloud.
void updateCloudMembers ()
 Computes the point cloud related members.

Private Attributes

float center_xyz_ [XYZ_SIZE]
Cloud3D cloud_
 The internal representation of the cloud.
float cloud_matrix_ [MATRIX_SIZE]
 A (4x4) OpenGL transform matrix for rendering the cloud.
float color_ [RGB]
Axis color_ramp_axis_
 The axis which the color ramp is to be applied when drawing the cloud.
float display_scale_
float highlight_color_ [RGB]
 The R, G, B values used for highlighting the selected points.
float max_xyz_ [XYZ_SIZE]
float min_xyz_ [XYZ_SIZE]
IndexVector partitioned_indices_
float point_size_
 The size used for rendering the unselected points in the cloud.
float select_matrix_ [MATRIX_SIZE]
float select_translate_x_
 The translations on x, y, and z axis on the selected points.
float select_translate_y_
float select_translate_z_
float selected_point_size_
 The size used for rendering the selected points in the cloud.
boost::weak_ptr< Selectionselection_wk_ptr_
bool use_color_ramp_
bool use_native_color_

Detailed Description

A wrapper which allows to use any implementation of cloud provided by a third-party library.

This wrapper attempts to create a simple interface for displaying and modifying point clouds. It is common for point clouds to have coordinate values that are exceptionally large, especially when dealing with the GIS community. As such this class shifts the stored point cloud according to the minimum in each of the coordinate directions. The interface presented by this class then serves the shifted points in order to reduce any precision errors that may occur due to sums of large values. Functions also exist for accessing the unshifted versions of the points, however most operations performed on the cloud will expect it to live near the origin.

Definition at line 65 of file cloud.h.


Constructor & Destructor Documentation

Default Constructor.

Definition at line 63 of file cloud.cpp.

Cloud::Cloud ( const Cloud copy)

Copy Constructor.

This constructor creates a copy of the passed cloud. The values of the member variables of the passed cloud are deep copied.

Parameters:
copyThe cloud object to be used to initialize this cloud object.

Definition at line 103 of file cloud.cpp.

Cloud::Cloud ( const Cloud3D cloud,
bool  register_stats = false 
)

Construct a cloud from a Cloud3D.

This constructor creates a cloud object with the passed cloud object stored with the internal representation. The member variables of this object are initialized but not set.

Definition at line 81 of file cloud.cpp.

Destructor.

Definition at line 123 of file cloud.cpp.


Member Function Documentation

void Cloud::append ( const Point3D point)

Appends a new 3D point to the cloud.

Parameters:
pointthe new point to be added.

Definition at line 328 of file cloud.cpp.

void Cloud::append ( const Cloud cloud)

Appends the points of the passed cloud to this cloud.

Parameters:
cloudthe cloud to be appended to this cloud.

Definition at line 334 of file cloud.cpp.

void Cloud::clear ( )

Removes all points from the cloud and resets the object.

Reimplemented from Statistics.

Definition at line 358 of file cloud.cpp.

void Cloud::disableTexture ( ) const [private]

Disable the texture used for rendering the cloud.

Definition at line 523 of file cloud.cpp.

void Cloud::draw ( bool  disable_highlight = false) const

Renders the cloud and highlights any selected points.

Parameters:
disableHighlightDefaults to false. If true the selected points will not be drawn.
See also:
setColorRampAxis, setColorRamp

Definition at line 258 of file cloud.cpp.

Renders the cloud with the color used for highlighting the selected points.

Definition at line 249 of file cloud.cpp.

void Cloud::drawWithPureColor ( ) const

Renders the cloud and highlights any selected points.

The non-selected points are in a single color

Definition at line 241 of file cloud.cpp.

void Cloud::drawWithRGB ( ) const

Renders the cloud and highlights any selected points.

The colors of the non-selected points uses the native color of the original points

Precondition:
The cloud should be originally colored.

Definition at line 232 of file cloud.cpp.

void Cloud::drawWithTexture ( ) const

Renders the cloud and highlights any selected points.

The colors of the non-selected points come from a 1D texture which is implemented by a color ramp.

Definition at line 224 of file cloud.cpp.

void Cloud::enableTexture ( ) const [private]

Enable the texture used for rendering the cloud.

Definition at line 498 of file cloud.cpp.

void Cloud::getCenter ( float &  x,
float &  y,
float &  z 
) const [inline]

Returns the center of the point cloud.

Parameters:
xThe x coordinate of the center (computed as the average point).
yThe y coordinate of the center (computed as the average point).
zThe z coordinate of the center (computed as the average point).

Definition at line 119 of file cloud.h.

Point3D Cloud::getDisplaySpacePoint ( unsigned int  index) const

Compute the transformed coordinates of the indexed point in the cloud to match the display.

To save on computation, the points in the display are not transformed on the cpu side, instead the gpu is allowed to manipulate them for display. This function performs the same manipulation and returns the transformed point.

Parameters:
indexThe index of the point whose coordinates are transformed according to the display.
Returns:
The transformed point.

Definition at line 403 of file cloud.cpp.

void Cloud::getDisplaySpacePoints ( std::vector< Point3D > &  pts) const

Compute the transformed coordinates of the all the points in the cloud to match the display.

To save on computation, the points in the display are not transformed on the cpu side, instead the gpu is allowed to manipulate them for display. This function performs the same manipulation and returns the transformed points.

Parameters:
ptsa vector used to store the points whose coordinates are transformed.

Definition at line 431 of file cloud.cpp.

const Cloud3D & Cloud::getInternalCloud ( ) const

Returns a const reference to the internal representation of this object.

Definition at line 438 of file cloud.cpp.

const float* Cloud::getMatrix ( ) const [inline]

Gets the transform matrix.

The returned matrix is used to transform the cloud for rendering only and does not affect the values of the points stored.

Returns:
A 1-D array representing (4 x 4) matrix in using OpenGL's column-major format.

Definition at line 140 of file cloud.h.

Point3D Cloud::getObjectSpacePoint ( unsigned int  index) const

Compute the transformed coordinates of the indexed point in the cloud according to the object transform.

This applies the object rotation and translation of the indexed point according to the user transforms.

Parameters:
indexThe index of the point whose coordinates are transformed.
Returns:
The transformed point.

Definition at line 376 of file cloud.cpp.

float Cloud::getScalingFactor ( ) const [inline]

Returns the scaling factor for the point cloud.

Returns:
The scaling factor

Definition at line 128 of file cloud.h.

std::string Cloud::getStat ( ) const [virtual]

Get statistics of the selected points in string.

Implements Statistics.

Definition at line 461 of file cloud.cpp.

void Cloud::loadMatrix ( const float *  matrix)

Sets the transform matrix for the cloud.

The passed matrix is used to transform the cloud for rendering only and does not affect the values of the points stored.

Precondition:
The passed pointer represents a matrix having valid memory of at least MATRIX_SIZE elements.
Parameters:
matrixa 1-D array representing (4 x 4) matrix in using OpenGL's column-major format.

Definition at line 164 of file cloud.cpp.

void Cloud::multMatrix ( const float *  matrix)

Right multiplies the cloud matrix with the passed matrix.

The application of this matrix effectively transforms the cloud from its current state. The passed matrix is used for display only and does not affect the values of the points stored.

Precondition:
The passed pointer represents a matrix having valid memory of at least MATRIX_SIZE elements.
Parameters:
matrixa 1-D array representing (4 x 4) matrix in using OpenGL's column-major format.

Definition at line 170 of file cloud.cpp.

Cloud & Cloud::operator= ( const Cloud cloud)

Equal Operator.

Deep copies all the state of the passed cloud to this cloud.

Parameters:
cloudThe cloud object whose status to be copied to this object
Returns:
A reference to this cloud containing the new values.

Definition at line 126 of file cloud.cpp.

Point3D & Cloud::operator[] ( unsigned int  index)

Subscript Operator.

This operator returns a reference to the point with the passed index in this cloud object.

Precondition:
The index passed is expected to be within the limits of the cloud. For debugging this is currently checked by an assert.
Parameters:
indexThe index of the point to be returned.
Returns:
A reference to the indexed point.

Definition at line 150 of file cloud.cpp.

const Point3D & Cloud::operator[] ( unsigned int  index) const

Subscript Operator.

This operator returns a const reference to the point with the passed index in this cloud object.

Precondition:
The index passed is expected to be within the limits of the cloud. For debugging this is currently checked by an assert.
Parameters:
indexThe index of the point to be returned.
Returns:
A const reference to the indexed point.

Definition at line 157 of file cloud.cpp.

void Cloud::remove ( const Selection selection)

Removes the points in selection from the cloud.

Each indexed point in the selection will be removed from this container.

Precondition:
The index of each point in the selection is expected to be within the limits of the cloud. For debugging this is currently checked by an assert. Also, it is expected that the selection indices are sorted.
Parameters:
selectiona selection object which stores the indices of the selected points.
Remarks:
This function requires the use of Selection::isSelected and its complexity can vary based on the implementation of that function.

Definition at line 340 of file cloud.cpp.

void Cloud::resize ( unsigned int  new_size)

Sets the size of the cloud of this object to the passed new size.

If the size is smaller than the current size, only the first new_size points will be kept, the rest being dropped. If new_size is larger than the current size, the new points required to fill the extended region are created with its default constructor.

Parameters:
new_sizethe new size of the cloud.

Definition at line 350 of file cloud.cpp.

void Cloud::restore ( const CopyBuffer copy_buffer,
const Selection selection 
)

Places the points in the copy buffer into the cloud according to the indices in the selection.

Definition at line 444 of file cloud.cpp.

void Cloud::setColorRamp ( bool  on_off) [inline]

Enables/Disables the use of the color ramp in display.

The color ramp aids in the visualization of the displayed points by varying the color according to a linear ramp along one of the axes.

Parameters:
onOffTrue enables the use of the color ramp and false disables.

Definition at line 261 of file cloud.h.

void Cloud::setColorRampAxis ( Axis  a) [inline]

Sets the axis along which the displyed points should have the color ramp applied.

Parameters:
aThe axis id describing which direction the ramp should be applied.

Definition at line 249 of file cloud.h.

void Cloud::setHighlightColor ( float  r,
float  g,
float  b 
)

Sets the RGB values used for highlighting the selected points.

Parameters:
rthe value for red color
gthe value for the green color
bthe value for the blue color

Definition at line 216 of file cloud.cpp.

void Cloud::setHighlightPointSize ( int  size)

Set the sizes used for rendering the selected points.

Parameters:
sizeThe size, in pixels, used for rendering the points.

Definition at line 370 of file cloud.cpp.

void Cloud::setPointSize ( int  size)

Set the sizes used for rendering the unselected points.

Parameters:
sizeThe size, in pixels, used for rendering the points.

Definition at line 364 of file cloud.cpp.

void Cloud::setRGB ( float  r,
float  g,
float  b 
)

Sets the RGB values for coloring points in COLOR_BY_PURE mode.

Parameters:
rthe value for red color
gthe value for the green color
bthe value for the blue color

Definition at line 208 of file cloud.cpp.

void Cloud::setSelection ( SelectionPtr  selection_ptr)

Sets the selected points.

The cloud object is responsible for its display. As we have tried to adopt a lazy approach in the application of modifications to the cloud, the cloud must be notified of the selected points. This is required as the user may move the selected points and we do not wish for the selected points to be drawn twice, once in the user-updated position and another in the points original location.

Precondition:
Assumes that the selection stores the selected indices of the points sorted.
Parameters:
Apointer pointing to a selection object.
Remarks:
This has been implemented using a weak pointer to allow a lazy update to occur. When a selection is destroyed we can switch to a faster rendering mode; this also occurs if the selection object is empty.

Definition at line 190 of file cloud.cpp.

void Cloud::setSelectionRotation ( const float *  matrix)

Sets the selection transform matrix to the one passed.

The selection matrix represents the local transformations applied to the selected points. The matrix is used relative to the cloud's state after the application of its own matrices which can be modified by loadMatrix and multMatrix functions.

Precondition:
The passed pointer represents a matrix having valid memory of at least MATRIX_SIZE elements.
Parameters:
matrixa 1-D array representing (4 x 4) matrix in using OpenGL's column-major format.
See also:
loadMatrix multMatrix

Definition at line 176 of file cloud.cpp.

void Cloud::setSelectionTranslation ( float  dx,
float  dy,
float  dz 
)

Definition at line 182 of file cloud.cpp.

unsigned int Cloud::size ( ) const [inline]

Gets the size of the cloud.

Definition at line 292 of file cloud.h.

void Cloud::updateCloudMembers ( ) [private]

Computes the point cloud related members.

The cloud keeps track of certain values related to the points in the cloud. These include the minimum coordinates and the ranges in the coordinate directions.

Precondition:
Assumes that there is at least one dimension of the point cloud that has non-zero range.

Definition at line 470 of file cloud.cpp.


Member Data Documentation

float Cloud::center_xyz_[XYZ_SIZE] [private]

The center coordinate values in the point cloud. This is used for display.

Definition at line 427 of file cloud.h.

The internal representation of the cloud.

Definition at line 403 of file cloud.h.

A (4x4) OpenGL transform matrix for rendering the cloud.

Definition at line 438 of file cloud.h.

float Cloud::color_[RGB] [private]

The R, G, B values used for coloring each points when the current color scheme is COLOR_BY_PURE.

Definition at line 460 of file cloud.h.

The axis which the color ramp is to be applied when drawing the cloud.

Definition at line 419 of file cloud.h.

const float Cloud::DEFAULT_POINT_DISPLAY_COLOR_BLUE_ = 1.0f [static]

Default Point Color - Blue componenet.

Definition at line 376 of file cloud.h.

const float Cloud::DEFAULT_POINT_DISPLAY_COLOR_GREEN_ = 1.0f [static]

Default Point Color - Green componenet.

Definition at line 374 of file cloud.h.

const float Cloud::DEFAULT_POINT_DISPLAY_COLOR_RED_ = 1.0f [static]

Default Point Color - Red componenet.

Definition at line 372 of file cloud.h.

const float Cloud::DEFAULT_POINT_DISPLAY_SIZE_ = 2.0f [static]

Default Point Size.

Definition at line 368 of file cloud.h.

const float Cloud::DEFAULT_POINT_HIGHLIGHT_COLOR_BLUE_ = 0.0f [static]

Default Point Highlight Color - Blue componenet.

Definition at line 382 of file cloud.h.

const float Cloud::DEFAULT_POINT_HIGHLIGHT_COLOR_GREEN_ = 1.0f [static]

Default Point Highlight Color - Green componenet.

Definition at line 380 of file cloud.h.

const float Cloud::DEFAULT_POINT_HIGHLIGHT_COLOR_RED_ = 0.0f [static]

Default Point Highlight Color - Red componenet.

Definition at line 378 of file cloud.h.

const float Cloud::DEFAULT_POINT_HIGHLIGHT_SIZE_ = 4.0f [static]

Default Highlight Point Size.

Definition at line 370 of file cloud.h.

float Cloud::display_scale_ [private]

A scale value used to normalize the display of clouds. This is simply one over the maximum of the range in each coordinate direction

Definition at line 423 of file cloud.h.

float Cloud::highlight_color_[RGB] [private]

The R, G, B values used for highlighting the selected points.

Definition at line 463 of file cloud.h.

float Cloud::max_xyz_[XYZ_SIZE] [private]

The maximum coordinate values in the point cloud. This is used for display.

Definition at line 435 of file cloud.h.

float Cloud::min_xyz_[XYZ_SIZE] [private]

The minimum coordinate values in the point cloud. This is used for display.

Definition at line 431 of file cloud.h.

A vector of indices for every point in the cloud. This vector is used when a selection is set and sorted such that the selected indices appear first in the vector. This is used during display to allow for separate indexed drawing of the selection and the point cloud. Note that this vector is partitioned according to selected and not-selected.

Definition at line 450 of file cloud.h.

float Cloud::point_size_ [private]

The size used for rendering the unselected points in the cloud.

Definition at line 453 of file cloud.h.

A (4x4) OpenGL transform matrix specifying the relative transformations that are applied to the selected points in the cloud when drawing them as highlighted.

Definition at line 443 of file cloud.h.

float Cloud::select_translate_x_ [private]

The translations on x, y, and z axis on the selected points.

Definition at line 466 of file cloud.h.

float Cloud::select_translate_y_ [private]

Definition at line 466 of file cloud.h.

float Cloud::select_translate_z_ [private]

Definition at line 466 of file cloud.h.

float Cloud::selected_point_size_ [private]

The size used for rendering the selected points in the cloud.

Definition at line 456 of file cloud.h.

boost::weak_ptr<Selection> Cloud::selection_wk_ptr_ [private]

A weak pointer pointing to the selection object.

This implementation uses the weak pointer to allow for a lazy update of the cloud if the selection object is destroyed.

Definition at line 408 of file cloud.h.

bool Cloud::use_color_ramp_ [private]

Flag that indicates whether a color ramp should be used (true) or not (false) when displaying the cloud

Definition at line 412 of file cloud.h.

bool Cloud::use_native_color_ [private]

Flag that indicates whether the cloud should be colored with its own color

Definition at line 416 of file cloud.h.


The documentation for this class was generated from the following files:


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:38:49