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

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>

Inheritance diagram for SelectionTransformTool:
Inheritance graph
[legend]

List of all members.

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

Detailed Description

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.


Constructor & Destructor Documentation

SelectionTransformTool::SelectionTransformTool ( ConstSelectionPtr  selection_ptr,
CloudPtr  cloud_ptr,
CommandQueuePtr  command_queue_ptr 
)

Constructor.

Parameters:
selection_ptra shared pointer pointing to the selection object.
cloud_ptra shared pointer pointing to the cloud object.
command_queue_ptra shared pointer pointing to the command queue.

Definition at line 50 of file selectionTransformTool.cpp.

Destructor.

Definition at line 66 of file selectionTransformTool.h.


Member Function Documentation

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.

Parameters:
xthe x value of the mouse screen coordinates.
ythe y value of the mouse screen coordinates.
modifiersthe key modifier.

Implements ToolInterface.

Definition at line 126 of file selectionTransformTool.cpp.

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.

Parameters:
dxthe distance between the x coordinates of the starting and ending cursor position.
dythe distance between the y coordinates of the starting and ending cursor position.
rotation_matrix_aa 4x4 matrix following OpenGL's format implementing rotation along x-axis.
rotation_matrix_ba 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.

Parameters:
xthe x value of the mouse screen coordinates.
ythe y value of the mouse screen coordinates.
modifiersthe 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.

Parameters:
xthe x value of the mouse screen coordinates.
ythe y value of the mouse screen coordinates.
modifiersthe 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.


Member Data Documentation

The centroid of the selected points.

Definition at line 148 of file selectionTransformTool.h.

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.

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.

the trackball associated with this transform

Definition at line 142 of file selectionTransformTool.h.

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.

scaling factor used to control the speed which the display translates the point cloud

Definition at line 156 of file selectionTransformTool.h.

last recorded mouse positions

Definition at line 145 of file selectionTransformTool.h.

Definition at line 145 of file selectionTransformTool.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:53