The selection transform tool computes the transform matrix from mouse input. It then updates the cloud's transform matrix for the selected points so that the transformed and selected points will be rendered appropriately. Note that, the actual coordinates of the selected points are not updated until the end of the mouse input. At the end of a mouse input (i.e. when the mouse button is released), a transform command is created to update the actual coordinates of the selected points. More...
#include <selectionTransformTool.h>
Public Member Functions | |
void | draw () const |
This does not do anything. | |
void | end (int x, int y, BitMask modifiers, BitMask buttons) |
Update the transform matrix for the selected points using the final position of the mouse. To finalize the transformation, we then create a transform command which computes the new coordinates of the selected points after transformation. | |
SelectionTransformTool (ConstSelectionPtr selection_ptr, CloudPtr cloud_ptr, CommandQueuePtr command_queue_ptr) | |
Constructor. | |
void | start (int x, int y, BitMask modifiers, BitMask buttons) |
Initialize the transform tool 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. Then the selection_matrix_ in the cloud is further updated. | |
~SelectionTransformTool () | |
Destructor. | |
Private Member Functions | |
void | findSelectionCenter () |
Computes the centroid of the selected points. | |
void | getRotateMatrix (int dx, int dy, float *rotation_matrix_a, float *rotation_matrix_b, BitMask buttons) const |
Computes the modelview matrix for rotation. | |
Private Attributes | |
float | center_xyz_ [XYZ_SIZE] |
The centroid of the selected points. | |
CloudPtr | cloud_ptr_ |
a shared pointer pointing to the cloud object | |
CommandQueuePtr | command_queue_ptr_ |
a shared pointer pointing to the command queue of the widget. | |
BitMask | modifiers_ |
the copy of the modifiers passed in the start function. | |
ConstSelectionPtr | selection_ptr_ |
a shared pointer pointing to the selection object | |
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_TRANSLATE_FACTOR_ = 0.001 |
default translation factor |
The selection transform tool computes the transform matrix from mouse input. It then updates the cloud's transform matrix for the selected points so that the transformed and selected points will be rendered appropriately. Note that, the actual coordinates of the selected points are not updated until the end of the mouse input. At the end of a mouse input (i.e. when the mouse button is released), a transform command is created to update the actual coordinates of the selected points.
Definition at line 54 of file selectionTransformTool.h.
SelectionTransformTool::SelectionTransformTool | ( | ConstSelectionPtr | selection_ptr, |
CloudPtr | cloud_ptr, | ||
CommandQueuePtr | command_queue_ptr | ||
) |
Constructor.
selection_ptr | a shared pointer pointing to the selection object. |
cloud_ptr | a shared pointer pointing to the cloud object. |
command_queue_ptr | a shared pointer pointing to the command queue. |
Definition at line 50 of file selectionTransformTool.cpp.
SelectionTransformTool::~SelectionTransformTool | ( | ) | [inline] |
Destructor.
Definition at line 66 of file selectionTransformTool.h.
void SelectionTransformTool::draw | ( | ) | const [inline, virtual] |
This does not do anything.
Implements ToolInterface.
Definition at line 109 of file selectionTransformTool.h.
void SelectionTransformTool::end | ( | int | x, |
int | y, | ||
BitMask | modifiers, | ||
BitMask | buttons | ||
) | [virtual] |
Update the transform matrix for the selected points using the final position of the mouse. To finalize the transformation, we then create a transform command which computes the new coordinates of the selected points after transformation.
x | the x value of the mouse screen coordinates. |
y | the y value of the mouse screen coordinates. |
modifiers | the key modifier. |
Implements ToolInterface.
Definition at line 126 of file selectionTransformTool.cpp.
void SelectionTransformTool::findSelectionCenter | ( | ) | [private] |
Computes the centroid of the selected points.
Definition at line 191 of file selectionTransformTool.cpp.
void SelectionTransformTool::getRotateMatrix | ( | int | dx, |
int | dy, | ||
float * | rotation_matrix_a, | ||
float * | rotation_matrix_b, | ||
BitMask | buttons | ||
) | const [private] |
Computes the modelview matrix for rotation.
dx | the distance between the x coordinates of the starting and ending cursor position. |
dy | the distance between the y coordinates of the starting and ending cursor position. |
rotation_matrix_a | a 4x4 matrix following OpenGL's format implementing rotation along x-axis. |
rotation_matrix_b | a 4x4 matrix following OpenGL's format implementing rotation along y or z-axis, which depens on which the mouse button that is being pressed during the rotation operation. |
void SelectionTransformTool::start | ( | int | x, |
int | y, | ||
BitMask | modifiers, | ||
BitMask | buttons | ||
) | [virtual] |
Initialize the transform tool 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 key modifier. |
Implements ToolInterface.
Definition at line 63 of file selectionTransformTool.cpp.
void SelectionTransformTool::update | ( | int | x, |
int | y, | ||
BitMask | modifiers, | ||
BitMask | buttons | ||
) | [virtual] |
Updates the transform matrix of this object with mouse screen coordinates and key modifiers. Then the selection_matrix_ in the cloud is further updated.
We first compute the changes between the initial and the current mouse screen coordinates. Then depending on the passed modifiers, the transformation matrix is computed correspondingly. If CONTROL is pressed the selection will be translated (panned) parallel to the view plane. If ALT is pressed the selection witll be translated along the z-axis perpendicular to the view plane. If no key modifiers is pressed the selection will be rotated.
x | the x value of the mouse screen coordinates. |
y | the y value of the mouse screen coordinates. |
modifiers | the key modifier. CONTROL pans the selection parallel to the view plane. ALT moves the selection in/out along the z-axis (perpendicular to the view plane). If no modifier is pressed then the selection is rotated. |
Implements ToolInterface.
Definition at line 78 of file selectionTransformTool.cpp.
float SelectionTransformTool::center_xyz_[XYZ_SIZE] [private] |
The centroid of the selected points.
Definition at line 148 of file selectionTransformTool.h.
CloudPtr SelectionTransformTool::cloud_ptr_ [private] |
a shared pointer pointing to the cloud object
Definition at line 136 of file selectionTransformTool.h.
a shared pointer pointing to the command queue of the widget.
Definition at line 139 of file selectionTransformTool.h.
const float SelectionTransformTool::DEFAULT_TRANSLATE_FACTOR_ = 0.001 [static, private] |
default translation factor
Definition at line 159 of file selectionTransformTool.h.
BitMask SelectionTransformTool::modifiers_ [private] |
the copy of the modifiers passed in the start function.
Definition at line 162 of file selectionTransformTool.h.
a shared pointer pointing to the selection object
Definition at line 133 of file selectionTransformTool.h.
TrackBall SelectionTransformTool::trackball_ [private] |
the trackball associated with this transform
Definition at line 142 of file selectionTransformTool.h.
float SelectionTransformTool::transform_matrix_[MATRIX_SIZE] [private] |
the transform matrix to be used for updating the coordinates of the selected points in the cloud
Definition at line 152 of file selectionTransformTool.h.
float SelectionTransformTool::translate_factor_ [private] |
scaling factor used to control the speed which the display translates the point cloud
Definition at line 156 of file selectionTransformTool.h.
int SelectionTransformTool::x_ [private] |
last recorded mouse positions
Definition at line 145 of file selectionTransformTool.h.
int SelectionTransformTool::y_ [private] |
Definition at line 145 of file selectionTransformTool.h.