A wrapper which allows to use any implementation of cloud provided by a third-party library. More...
#include <cloud.h>
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 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 Cloud3D & | getInternalCloud () 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. | |
Cloud & | operator= (const Cloud &cloud) |
Equal Operator. | |
Point3D & | operator[] (unsigned int index) |
Subscript Operator. | |
const Point3D & | operator[] (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 ©_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< Selection > | selection_wk_ptr_ |
bool | use_color_ramp_ |
bool | use_native_color_ |
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.
Cloud::Cloud | ( | ) |
Cloud::Cloud | ( | const Cloud & | copy | ) |
Cloud::Cloud | ( | const Cloud3D & | cloud, |
bool | register_stats = false |
||
) |
Cloud::~Cloud | ( | ) |
void Cloud::append | ( | const Point3D & | point | ) |
void Cloud::append | ( | const Cloud & | cloud | ) |
void Cloud::clear | ( | ) |
Removes all points from the cloud and resets the object.
Reimplemented from Statistics.
void Cloud::disableTexture | ( | ) | const [private] |
void Cloud::draw | ( | bool | disable_highlight = false | ) | const |
Renders the cloud and highlights any selected points.
disableHighlight | Defaults to false. If true the selected points will not be drawn. |
void Cloud::drawWithHighlightColor | ( | ) | const |
void Cloud::drawWithPureColor | ( | ) | const |
void Cloud::drawWithRGB | ( | ) | const |
void Cloud::drawWithTexture | ( | ) | const |
void Cloud::enableTexture | ( | ) | const [private] |
void Cloud::getCenter | ( | float & | x, |
float & | y, | ||
float & | z | ||
) | const [inline] |
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.
index | The index of the point whose coordinates are transformed according to the display. |
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.
pts | a vector used to store the points whose coordinates are transformed. |
const Cloud3D & Cloud::getInternalCloud | ( | ) | const |
const float* Cloud::getMatrix | ( | ) | const [inline] |
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.
index | The index of the point whose coordinates are transformed. |
float Cloud::getScalingFactor | ( | ) | const [inline] |
std::string Cloud::getStat | ( | ) | const [virtual] |
Get statistics of the selected points in string.
Implements Statistics.
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.
matrix | a 1-D array representing (4 x 4) matrix in using OpenGL's column-major format. |
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.
matrix | a 1-D array representing (4 x 4) matrix in using OpenGL's column-major format. |
Point3D & Cloud::operator[] | ( | unsigned int | index | ) |
Subscript Operator.
This operator returns a reference to the point with the passed index in this cloud object.
index | The index of the point to be returned. |
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.
index | The index of the point to be returned. |
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.
selection | a selection object which stores the indices of the selected points. |
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.
new_size | the new size of the cloud. |
void Cloud::restore | ( | const CopyBuffer & | copy_buffer, |
const Selection & | selection | ||
) |
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.
onOff | True enables the use of the color ramp and false disables. |
void Cloud::setColorRampAxis | ( | Axis | a | ) | [inline] |
void Cloud::setHighlightColor | ( | float | r, |
float | g, | ||
float | b | ||
) |
void Cloud::setHighlightPointSize | ( | int | size | ) |
void Cloud::setPointSize | ( | int | size | ) |
void Cloud::setRGB | ( | float | r, |
float | g, | ||
float | b | ||
) |
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.
A | pointer pointing to a selection object. |
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.
matrix | a 1-D array representing (4 x 4) matrix in using OpenGL's column-major format. |
void Cloud::setSelectionTranslation | ( | float | dx, |
float | dy, | ||
float | dz | ||
) |
unsigned int Cloud::size | ( | ) | const [inline] |
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.
float Cloud::center_xyz_[XYZ_SIZE] [private] |
Cloud3D Cloud::cloud_ [private] |
float Cloud::cloud_matrix_[MATRIX_SIZE] [private] |
float Cloud::color_[RGB] [private] |
Axis Cloud::color_ramp_axis_ [private] |
const float Cloud::DEFAULT_POINT_DISPLAY_COLOR_BLUE_ = 1.0f [static] |
const float Cloud::DEFAULT_POINT_DISPLAY_COLOR_GREEN_ = 1.0f [static] |
const float Cloud::DEFAULT_POINT_DISPLAY_COLOR_RED_ = 1.0f [static] |
const float Cloud::DEFAULT_POINT_DISPLAY_SIZE_ = 2.0f [static] |
const float Cloud::DEFAULT_POINT_HIGHLIGHT_COLOR_BLUE_ = 0.0f [static] |
const float Cloud::DEFAULT_POINT_HIGHLIGHT_COLOR_GREEN_ = 1.0f [static] |
const float Cloud::DEFAULT_POINT_HIGHLIGHT_COLOR_RED_ = 0.0f [static] |
const float Cloud::DEFAULT_POINT_HIGHLIGHT_SIZE_ = 4.0f [static] |
float Cloud::display_scale_ [private] |
float Cloud::highlight_color_[RGB] [private] |
float Cloud::max_xyz_[XYZ_SIZE] [private] |
float Cloud::min_xyz_[XYZ_SIZE] [private] |
IndexVector Cloud::partitioned_indices_ [private] |
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.
float Cloud::point_size_ [private] |
float Cloud::select_matrix_[MATRIX_SIZE] [private] |
float Cloud::select_translate_x_ [private] |
float Cloud::select_translate_y_ [private] |
float Cloud::select_translate_z_ [private] |
float Cloud::selected_point_size_ [private] |
boost::weak_ptr<Selection> Cloud::selection_wk_ptr_ [private] |
bool Cloud::use_color_ramp_ [private] |
bool Cloud::use_native_color_ [private] |