An transform tool for translating, rotating, and scaling objects.
More...
#include <TransformController.hh>
|
| TransformController () |
| Constructor.
|
|
virtual | ~TransformController () |
| Destructor.
|
|
virtual bool | Active () const |
| Check if the transform process is active.
|
|
virtual math::Vector3d | ActiveAxis () const |
| Get the current highlighted active axis of transform.
|
|
virtual void | Attach (NodePtr _node) |
| Attach the transform controller to the specified node.
|
|
virtual math::Vector3d | AxisById (unsigned int _id) const |
| Get the axis of transform represented by the given node id.
|
|
virtual CameraPtr | Camera () const |
| get the camera that is controlled by this view controller.
|
|
virtual void | Detach () |
| Detach the transform controller from the currently attached node.
|
|
virtual TransformMode | Mode () const |
| Get the current transform mode.
|
|
virtual NodePtr | Node () const |
| Get the attached node.
|
|
virtual void | Rotate (const math::Quaterniond &_rotation, bool _snap=false) |
| Rotate the attached node.
|
|
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.
|
|
virtual void | Scale (const math::Vector3d &_scale, bool _snap=false) |
| Scale the attached node.
|
|
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.
|
|
virtual void | SetActiveAxis (const math::Vector3d &_axis) |
| Set the active transform axis. This highlights the axis visual.
|
|
virtual void | SetCamera (const CameraPtr &_camera) |
| Set the camera.
|
|
virtual void | SetTransformMode (TransformMode _mode) |
| Set the transform mode.
|
|
virtual void | SetTransformSpace (TransformSpace _space) |
| Set the transform space.
|
|
virtual TransformSpace | Space () const |
| Get the transform space.
|
|
virtual void | Start () |
| Start the transform process. To be used with helper functions that computions transforms from 2d movements.
|
|
virtual void | Stop () |
| Stop the transform process. To be used with helper functions that computions transforms from 2d movements.
|
|
virtual void | Translate (const math::Vector3d &_translation, bool _snap=false) |
| Translate the attached node.
|
|
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.
|
|
virtual void | Update () |
| Update the transform controller. Its visual is updated based on the current transform mode, space, and axis.
|
|
An transform tool for translating, rotating, and scaling objects.
◆ TransformController()
◆ ~TransformController()
◆ Active()
virtual bool Active |
( |
| ) |
const |
|
virtual |
Check if the transform process is active.
- Returns
- True if node is being transformed
◆ ActiveAxis()
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] | _node | Node that will be transformed |
◆ AxisById()
Get the axis of transform represented by the given node id.
- Parameters
-
[in] | _id | Id of the node to check |
- Returns
- Transform axis
◆ Camera()
get the camera that is controlled by this view controller.
- Returns
- camera being controlled
◆ CreatePlaneForTransform()
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] | _axis | Transformation axis used to identify the plane for projection. |
[in] | _pt2d | 2d point to help fine tune the plane created. |
- Returns
- Plane created for transform
◆ Detach()
Detach the transform controller from the currently attached node.
◆ Mode()
Get the current transform mode.
- Returns
- Transform mode
◆ Node()
Get the attached node.
- Returns
- The node which is being transformed, nullptr if there is no node attached.
◆ RayPlaneIntersection()
Helper function to compute ray plane intersection.
- Parameters
-
[in] | _ray | Input ray |
[in] | _plane | Plane to check for intersection |
[out] | _result | Intersection point |
- Returns
- True if intersection point exist, false if ray is parallel to plane
◆ Rotate()
Rotate the attached node.
- Parameters
-
[in] | _rotation | Rotation in the current transform space |
[in] | _snap | True to snap rotation angle to fixed increments |
- See also
- SetTransformSpace
◆ RotationFrom2d()
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] | _axis | Axis of 3d rotation. The resulting rotation is is constrained to this axis. |
[in] | _start | Starting position of the 2d translation movement |
[in] | _end | End 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] | _scale | Scale in the current transform space |
[in] | _snap | True to snap scale to fixed increments |
- See also
- SetTransformSpace
◆ ScaleFrom2d()
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] | _axis | Axis of scale. The resulting 3d vector is constrained to this axis. |
[in] | _start | Starting position of the 2d translation movement |
[in] | _end | End position of the 2d translation movement |
- Returns
- 3d scale vector in the current transform space
◆ SetActiveAxis()
Set the active transform axis. This highlights the axis visual.
- Parameters
-
[in] | _axis | Transform axis vector |
◆ SetCamera()
virtual void SetCamera |
( |
const CameraPtr & |
_camera | ) |
|
|
virtual |
Set the camera.
- Parameters
-
◆ SetTransformMode()
Set the transform mode.
- Parameters
-
[in] | _mode | Transform mode to set to |
◆ SetTransformSpace()
Set the transform space.
- Parameters
-
[in] | _space | Transform space to set to |
◆ SnapPoint()
Snap a point at intervals of a fixed distance. Currently used to give a snapping behavior when transforming objects.
- Parameters
-
[in] | _point | Input point. |
[in] | _interval | Fixed distance interval at which the point is snapped. |
[in] | _sensitivity | Sensitivity of point snapping, in terms of a percentage of the interval. |
- Returns
- Snapped 3D point.
◆ Space()
Get the transform space.
- Returns
- Transform space
◆ Start()
Start the transform process. To be used with helper functions that computions transforms from 2d movements.
- See also
- Stop
◆ Stop()
Stop the transform process. To be used with helper functions that computions transforms from 2d movements.
- See also
- Stop
◆ ToAxis()
Convert a TransformAxis to a vector type.
- Parameters
-
- Returns
- 3d axis vector
◆ Translate()
virtual void Translate |
( |
const math::Vector3d & |
_translation, |
|
|
bool |
_snap = false |
|
) |
| |
|
virtual |
Translate the attached node.
- Parameters
-
[in] | _translation | Translation in the current transform space |
[in] | _snap | True to snap the final position to fixed increments |
- See also
- SetTransformSpace
◆ TranslationFrom2d()
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] | _axis | Axis of 3d translation. The resulting 3d vector is constrained to this axis. |
[in] | _start | Starting position of the 2d translation movement |
[in] | _end | End position of the 2d translation movement |
- Returns
- 3d translation vector in the current transform space
◆ Update()
Update the transform controller. Its visual is updated based on the current transform mode, space, and axis.
◆ dataPtr
The documentation for this class was generated from the following file: