The cloud transform tool computes the transform matrix from user's mouse operation. It then updates the cloud with the new transform matrices to make the cloud be rendered appropriately. More...
#include <cloudTransformTool.h>
Public Member Functions | |
CloudTransformTool (CloudPtr cloud_ptr) | |
Constructor. | |
void | draw () const |
This function does nothing for this cloud transform tool. | |
void | end (int, int, BitMask, BitMask) |
Updates the transform matrix of this object with mouse screen coordinates and key modifiers. Then right multiplies the cloud_matrix_ matrix of the cloud object with the transform matrix of this object. | |
void | start (int x, int y, BitMask modifiers, BitMask buttons) |
Initialize the current transform with mouse screen coordinates and key modifiers. | |
void | update (int x, int y, BitMask modifiers, BitMask buttons) |
Updates the transform matrix of this object with mouse screen coordinates and key modifiers. | |
~CloudTransformTool () | |
Destructor. | |
Private Member Functions | |
void | getScaleMatrix (int dy, float *matrix) |
generate scale matrix | |
void | getTranslateMatrix (int dx, int dy, float *matrix) |
generate translate matrix for the xy plane | |
void | getZTranslateMatrix (int dy, float *matrix) |
generate translate matrix for the z direction | |
Private Attributes | |
CloudPtr | cloud_ptr_ |
a shared pointer pointing to the cloud object. | |
float | scale_factor_ |
TrackBall | trackball_ |
the trackball associated with this transform | |
float | transform_matrix_ [MATRIX_SIZE] |
float | translate_factor_ |
int | x_ |
last recorded mouse positions | |
int | y_ |
Static Private Attributes | |
static const float | DEFAULT_SCALE_FACTOR_ = 1.14 |
default scaling factor | |
static const float | DEFAULT_TRANSLATE_FACTOR_ = 0.001f |
default translation factor |
The cloud transform tool computes the transform matrix from user's mouse operation. It then updates the cloud with the new transform matrices to make the cloud be rendered appropriately.
Definition at line 51 of file cloudTransformTool.h.
CloudTransformTool::CloudTransformTool | ( | CloudPtr | cloud_ptr | ) |
Constructor.
cloud_ptr | a shared pointer pointing to the cloud object. |
Definition at line 52 of file cloudTransformTool.cpp.
Destructor.
Definition at line 59 of file cloudTransformTool.cpp.
void CloudTransformTool::draw | ( | ) | const [inline, virtual] |
This function does nothing for this cloud transform tool.
Implements ToolInterface.
Definition at line 104 of file cloudTransformTool.h.
void CloudTransformTool::end | ( | int | , |
int | , | ||
BitMask | , | ||
BitMask | |||
) | [inline, virtual] |
Updates the transform matrix of this object with mouse screen coordinates and key modifiers. Then right multiplies the cloud_matrix_ matrix of the cloud object with the transform matrix of this object.
This function is not required by this tool
Implements ToolInterface.
Definition at line 98 of file cloudTransformTool.h.
void CloudTransformTool::getScaleMatrix | ( | int | dy, |
float * | matrix | ||
) | [private] |
generate scale matrix
Definition at line 119 of file cloudTransformTool.cpp.
void CloudTransformTool::getTranslateMatrix | ( | int | dx, |
int | dy, | ||
float * | matrix | ||
) | [private] |
generate translate matrix for the xy plane
Definition at line 103 of file cloudTransformTool.cpp.
void CloudTransformTool::getZTranslateMatrix | ( | int | dy, |
float * | matrix | ||
) | [private] |
generate translate matrix for the z direction
Definition at line 112 of file cloudTransformTool.cpp.
void CloudTransformTool::start | ( | int | x, |
int | y, | ||
BitMask | modifiers, | ||
BitMask | buttons | ||
) | [virtual] |
Initialize the current transform with mouse screen coordinates and key modifiers.
x | the x value of the mouse screen coordinates. |
y | the y value of the mouse screen coordinates. |
modifiers | The keyboard modifiers. This function does not make use of this parameter. |
buttons | The state of the mouse buttons. This function does not make use of this parameter. |
Implements ToolInterface.
Definition at line 64 of file cloudTransformTool.cpp.
void CloudTransformTool::update | ( | int | x, |
int | y, | ||
BitMask | modifiers, | ||
BitMask | buttons | ||
) | [virtual] |
Updates the transform matrix of this object with mouse screen coordinates and key modifiers.
When the LEFT mouse button is down the motion of the mouse is used to compute various transforms for the cloud display. Depending on the modifiers, the transformation matrix is computed correspondingly. When shift is pressed, the motion of mouse indicates a scale. If no key modifiers is pressed, the mouse move indicates a rotation. The control key pans the display, and the alt key translates along the z-axis.
x | The x value of the mouse screen coordinates. |
y | The y value of the mouse screen coordinates. |
modifiers | the key modifier. SHIFT scales the point cloud display. CONTROL pans the point cloud parallel to the view plane. ALT moves the point cloud in/out along the z-axis (perpendicular to the view plane). If no modifier is pressed then the cloud display is rotated. |
buttons | The LEFT mouse button must be pressed for any transform to be generated. All other buttons are ignored. |
Implements ToolInterface.
Definition at line 73 of file cloudTransformTool.cpp.
CloudPtr CloudTransformTool::cloud_ptr_ [private] |
a shared pointer pointing to the cloud object.
Definition at line 127 of file cloudTransformTool.h.
const float CloudTransformTool::DEFAULT_SCALE_FACTOR_ = 1.14 [static, private] |
default scaling factor
Definition at line 144 of file cloudTransformTool.h.
const float CloudTransformTool::DEFAULT_TRANSLATE_FACTOR_ = 0.001f [static, private] |
default translation factor
Definition at line 147 of file cloudTransformTool.h.
float CloudTransformTool::scale_factor_ [private] |
scaling factor used to control the speed which the display scales the point cloud
Definition at line 137 of file cloudTransformTool.h.
TrackBall CloudTransformTool::trackball_ [private] |
the trackball associated with this transform
Definition at line 130 of file cloudTransformTool.h.
float CloudTransformTool::transform_matrix_[MATRIX_SIZE] [private] |
the transform matrix to be used for updating the coordinates of all the points in the cloud
Definition at line 124 of file cloudTransformTool.h.
float CloudTransformTool::translate_factor_ [private] |
scaling factor used to control the speed which the display translates the point cloud
Definition at line 141 of file cloudTransformTool.h.
int CloudTransformTool::x_ [private] |
last recorded mouse positions
Definition at line 133 of file cloudTransformTool.h.
int CloudTransformTool::y_ [private] |
Definition at line 133 of file cloudTransformTool.h.