Gazebo Rendering

API Reference

6.6.3

An transform tool for translating, rotating, and scaling objects. More...

#include <TransformController.hh>

Public Member Functions

 TransformController ()
 Constructor. More...
 
virtual ~TransformController ()
 Destructor. More...
 
virtual bool Active () const
 Check if the transform process is active. More...
 
virtual math::Vector3d ActiveAxis () const
 Get the current highlighted active axis of transform. More...
 
virtual void Attach (NodePtr _node)
 Attach the transform controller to the specified node. More...
 
virtual math::Vector3d AxisById (unsigned int _id) const
 Get the axis of transform represented by the given node id. More...
 
virtual CameraPtr Camera () const
 get the camera that is controlled by this view controller. More...
 
virtual void Detach ()
 Detach the transform controller from the currently attached node. More...
 
virtual TransformMode Mode () const
 Get the current transform mode. More...
 
virtual NodePtr Node () const
 Get the attached node. More...
 
virtual void Rotate (const math::Quaterniond &_rotation, bool _snap=false)
 Rotate the attached node. More...
 
math::Quaterniond RotationFrom2d (const math::Vector3d &_axis, const math::Vector2d &_start, const math::Vector2d &_end)
 Helper function to compute 3d rotation from 2d translation movement. Useful for converting 2d mouse drag motion to rotation angle in world frame. Note that the camera must be set and Start() must be called before using this function. More...
 
virtual void Scale (const math::Vector3d &_scale, bool _snap=false)
 Scale the attached node. More...
 
math::Vector3d ScaleFrom2d (const math::Vector3d &_axis, const math::Vector2d &_start, const math::Vector2d &_end)
 Helper function to compute 3d scale from 2d translation movement. Useful for converting 2d mouse drag motion to scale vector in world frame. Note that the camera must be set and Start() must be called before using this function. More...
 
virtual void SetActiveAxis (const math::Vector3d &_axis)
 Set the active transform axis. This highlights the axis visual. More...
 
virtual void SetCamera (const CameraPtr &_camera)
 Set the camera. More...
 
virtual void SetTransformMode (TransformMode _mode)
 Set the transform mode. More...
 
virtual void SetTransformSpace (TransformSpace _space)
 Set the transform space. More...
 
virtual TransformSpace Space () const
 Get the transform space. More...
 
virtual void Start ()
 Start the transform process. To be used with helper functions that computions transforms from 2d movements. More...
 
virtual void Stop ()
 Stop the transform process. To be used with helper functions that computions transforms from 2d movements. More...
 
virtual void Translate (const math::Vector3d &_translation, bool _snap=false)
 Translate the attached node. More...
 
math::Vector3d TranslationFrom2d (const math::Vector3d &_axis, const math::Vector2d &_start, const math::Vector2d &_end)
 Helper function to compute 3d translation from 2d translation movement. Useful for converting 2d mouse drag motion to displacement in world frame. Note that the camera must be set and Start() must be called before using this function. More...
 
virtual void Update ()
 Update the transform controller. Its visual is updated based on the current transform mode, space, and axis. More...
 

Static Public Member Functions

static gz::math::Vector3d SnapPoint (const gz::math::Vector3d &_point, const double _interval=1.0, const double _sensitivity=0.4)
 Snap a point at intervals of a fixed distance. Currently used to give a snapping behavior when transforming objects. More...
 
static math::Vector3d ToAxis (TransformAxis _axis)
 Convert a TransformAxis to a vector type. More...
 

Public Attributes

std::unique_ptr< TransformControllerPrivate > dataPtr
 Private data pointer. More...
 

Protected Member Functions

math::Planed CreatePlaneForTransform (const math::Vector3d &_axis, const math::Vector2d &_pt2d)
 Helper function to create a plane for transfomation. The plane is chosen based on the current transform mode and the transform axis specified. More...
 
bool RayPlaneIntersection (RayQueryPtr _ray, const math::Planed &_plane, math::Vector3d &_result)
 Helper function to compute ray plane intersection. More...
 

Detailed Description

An transform tool for translating, rotating, and scaling objects.

Constructor & Destructor Documentation

◆ TransformController()

Constructor.

◆ ~TransformController()

virtual ~TransformController ( )
virtual

Destructor.

Member Function Documentation

◆ Active()

virtual bool Active ( ) const
virtual

Check if the transform process is active.

Returns
True if node is being transformed

◆ ActiveAxis()

virtual math::Vector3d ActiveAxis ( ) const
virtual

Get the current highlighted active axis of transform.

Returns
Active axis of transform

◆ Attach()

virtual void Attach ( NodePtr  _node)
virtual

Attach the transform controller to the specified node.

Parameters
[in]_nodeNode that will be transformed

◆ AxisById()

virtual math::Vector3d AxisById ( unsigned int  _id) const
virtual

Get the axis of transform represented by the given node id.

Parameters
[in]_idId of the node to check
Returns
Transform axis

◆ Camera()

virtual CameraPtr Camera ( ) const
virtual

get the camera that is controlled by this view controller.

Returns
camera being controlled

◆ CreatePlaneForTransform()

math::Planed CreatePlaneForTransform ( const math::Vector3d _axis,
const math::Vector2d _pt2d 
)
protected

Helper function to create a plane for transfomation. The plane is chosen based on the current transform mode and the transform axis specified.

Parameters
[in]_axisTransformation axis used to identify the plane for projection.
[in]_pt2d2d point to help fine tune the plane created.
Returns
Plane created for transform

◆ Detach()

virtual void Detach ( )
virtual

Detach the transform controller from the currently attached node.

◆ Mode()

virtual TransformMode Mode ( ) const
virtual

Get the current transform mode.

Returns
Transform mode

◆ Node()

virtual NodePtr Node ( ) const
virtual

Get the attached node.

Returns
The node which is being transformed, nullptr if there is no node attached.

◆ RayPlaneIntersection()

bool RayPlaneIntersection ( RayQueryPtr  _ray,
const math::Planed _plane,
math::Vector3d _result 
)
protected

Helper function to compute ray plane intersection.

Parameters
[in]_rayInput ray
[in]_planePlane to check for intersection
[out]_resultIntersection point
Returns
True if intersection point exist, false if ray is parallel to plane

◆ Rotate()

virtual void Rotate ( const math::Quaterniond _rotation,
bool  _snap = false 
)
virtual

Rotate the attached node.

Parameters
[in]_rotationRotation in the current transform space
[in]_snapTrue to snap rotation angle to fixed increments
See also
SetTransformSpace

◆ RotationFrom2d()

math::Quaterniond RotationFrom2d ( const math::Vector3d _axis,
const math::Vector2d _start,
const math::Vector2d _end 
)

Helper function to compute 3d rotation from 2d translation movement. Useful for converting 2d mouse drag motion to rotation angle in world frame. Note that the camera must be set and Start() must be called before using this function.

Parameters
[in]_axisAxis of 3d rotation. The resulting rotation is is constrained to this axis.
[in]_startStarting position of the 2d translation movement
[in]_endEnd position of the 2d translation movement
Returns
Rotation in the current transform space

◆ Scale()

virtual void Scale ( const math::Vector3d _scale,
bool  _snap = false 
)
virtual

Scale the attached node.

Parameters
[in]_scaleScale in the current transform space
[in]_snapTrue to snap scale to fixed increments
See also
SetTransformSpace

◆ ScaleFrom2d()

math::Vector3d ScaleFrom2d ( const math::Vector3d _axis,
const math::Vector2d _start,
const math::Vector2d _end 
)

Helper function to compute 3d scale from 2d translation movement. Useful for converting 2d mouse drag motion to scale vector in world frame. Note that the camera must be set and Start() must be called before using this function.

Parameters
[in]_axisAxis of scale. The resulting 3d vector is constrained to this axis.
[in]_startStarting position of the 2d translation movement
[in]_endEnd position of the 2d translation movement
Returns
3d scale vector in the current transform space

◆ SetActiveAxis()

virtual void SetActiveAxis ( const math::Vector3d _axis)
virtual

Set the active transform axis. This highlights the axis visual.

Parameters
[in]_axisTransform axis vector

◆ SetCamera()

virtual void SetCamera ( const CameraPtr _camera)
virtual

Set the camera.

Parameters
[in]_cameraCamera

◆ SetTransformMode()

virtual void SetTransformMode ( TransformMode  _mode)
virtual

Set the transform mode.

Parameters
[in]_modeTransform mode to set to

◆ SetTransformSpace()

virtual void SetTransformSpace ( TransformSpace  _space)
virtual

Set the transform space.

Parameters
[in]_spaceTransform space to set to

◆ SnapPoint()

static gz::math::Vector3d SnapPoint ( const gz::math::Vector3d _point,
const double  _interval = 1.0,
const double  _sensitivity = 0.4 
)
static

Snap a point at intervals of a fixed distance. Currently used to give a snapping behavior when transforming objects.

Parameters
[in]_pointInput point.
[in]_intervalFixed distance interval at which the point is snapped.
[in]_sensitivitySensitivity of point snapping, in terms of a percentage of the interval.
Returns
Snapped 3D point.

◆ Space()

virtual TransformSpace Space ( ) const
virtual

Get the transform space.

Returns
Transform space

◆ Start()

virtual void Start ( )
virtual

Start the transform process. To be used with helper functions that computions transforms from 2d movements.

See also
Stop

◆ Stop()

virtual void Stop ( )
virtual

Stop the transform process. To be used with helper functions that computions transforms from 2d movements.

See also
Stop

◆ ToAxis()

static math::Vector3d ToAxis ( TransformAxis  _axis)
static

Convert a TransformAxis to a vector type.

Parameters
[in]_axisTransform axis
Returns
3d axis vector

◆ Translate()

virtual void Translate ( const math::Vector3d _translation,
bool  _snap = false 
)
virtual

Translate the attached node.

Parameters
[in]_translationTranslation in the current transform space
[in]_snapTrue to snap the final position to fixed increments
See also
SetTransformSpace

◆ TranslationFrom2d()

math::Vector3d TranslationFrom2d ( const math::Vector3d _axis,
const math::Vector2d _start,
const math::Vector2d _end 
)

Helper function to compute 3d translation from 2d translation movement. Useful for converting 2d mouse drag motion to displacement in world frame. Note that the camera must be set and Start() must be called before using this function.

Parameters
[in]_axisAxis of 3d translation. The resulting 3d vector is constrained to this axis.
[in]_startStarting position of the 2d translation movement
[in]_endEnd position of the 2d translation movement
Returns
3d translation vector in the current transform space

◆ Update()

virtual void Update ( )
virtual

Update the transform controller. Its visual is updated based on the current transform mode, space, and axis.

Member Data Documentation

◆ dataPtr

std::unique_ptr<TransformControllerPrivate> dataPtr

Private data pointer.


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