Katana Plug-in APIs 0.1
Public Member Functions | Static Public Member Functions | Protected Member Functions

GLRotateAxisHandle Class Reference

A handle to rotate the selected object along an axis. More...

#include <FnGLRotateAxisHandle.h>

Inheritance diagram for GLRotateAxisHandle:
Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle Foundry::Katana::ViewerUtils::GLManipulatorHandle Foundry::Katana::ViewerAPI::ManipulatorHandle Foundry::Katana::ViewerAPI::ManipulatorHandlePluginBase

List of all members.

Public Member Functions

 GLRotateAxisHandle ()
 Constructor.
virtual ~GLRotateAxisHandle ()
 Destructor.
void draw ()
void pickerDraw (int64_t pickerId)
void setup (const IMATH_NAMESPACE::V3d &axis)
 Initializes the axis and meshes. Called at handle creation.
void setupViewHandle ()
virtual Orientation getOrientation ()
 Defines the orientation space of the manipulator.
FnAttribute::Attribute getOption (Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type optionId)
 Gets the option given the option ID.

Static Public Member Functions

static
Foundry::Katana::ViewerAPI::ManipulatorHandle
create ()
 Creates a new instance of GLRotateAxisHandle.
static void flush ()
 Flushes any cached data.

Protected Member Functions

virtual std::string getComponentName ()
bool getDraggingPlane (Vec3d &origin, Vec3d &normal)
void startDrag (const Vec3d &initialPointOnPlane, const Vec2i &initialMousePosition)
void drag (const Vec3d &initialPointOnPlane, const Vec3d &previousPointOnPlane, const Vec3d &currentPointOnPlane, const Vec2i &initialMousePosition, const Vec2i &previousMousePosition, const Vec2i &currentMousePosition, bool isFinal)
void endDrag ()
void applyXformToLocation (const std::string &locationPath, const IMATH_NAMESPACE::M44d &xform, bool isFinal)

Detailed Description

A handle to rotate the selected object along an axis.

This class represents a single handle that can be used to rotate an object along a specified direction axis vector. It also shows how much the object is being rotated with the currend drag using a pie slice mesh.

The handle's position will depend on the transform order. For example, if the translation is applied before the rotation, then the handles will be placed away from the object's origin, since the rotation will pivot around that point away from the origin.

The transform created in drag() is relative to the rotation amount of the previous call to drag(), which means that applyXformToLocation() will apply this rotation transform to the previous value, rather than to the initial rotation of the object at drag start. This allows a more stable rotation calculation, given that the rotation amounts will be small on each drag.

Depending on if the rotation plane is close to perpendicular to the screen or not, the dragging will either be linear or oribital. Linear dragging is used when the rotation plane is close to perpendicular to the camera/screen plane. At this low gazing angles it is easier to simply allow the user to lineraly drag vertically or horizontally instead of orbiting it. In orbital dragging the user controls the amount of rotation by moving the mouse pointer around (orbiting) the origin. This is used in higher gazing angles in relation to the rotation plane and gives the user a more real-world-like rotation interface.

This also takes into account the rotation order, which doesn't affect the orientation of the 3 rotation axis, but influences the rotation values set by applyXformToLocation().


Member Function Documentation

void GLRotateAxisHandle::applyXformToLocation ( const std::string &  locationPath,
const IMATH_NAMESPACE::M44d &  xform,
bool  isFinal 
) [protected, virtual]

Applies the given rotation transform to the given location. This will also take the rotation order into account.

Implements Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

void GLRotateAxisHandle::drag ( const Vec3d initialPointOnPlane,
const Vec3d previousPointOnPlane,
const Vec3d currentPointOnPlane,
const Vec2i initialMousePosition,
const Vec2i previousMousePosition,
const Vec2i currentMousePosition,
bool  isFinal 
) [protected, virtual]

Detects the amount of rotation in either orbital or linear drag, depending on the direction of axis in relation to the camera direction, and applies the rotation to the manipulated locations.

Reimplemented from Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

void GLRotateAxisHandle::draw ( ) [virtual]

Draws the handle.

Reimplemented from Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

void GLRotateAxisHandle::endDrag ( ) [protected, virtual]

Resets the pie slices to avoid artifacts when the drag starts again.

Reimplemented from Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

virtual std::string GLRotateAxisHandle::getComponentName ( ) [inline, protected, virtual]

The transform component: xform.interactive.rotate?

Implements Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

bool GLRotateAxisHandle::getDraggingPlane ( Vec3d origin,
Vec3d normal 
) [protected, virtual]

Gets the dragging plane's origin and normal. The origin is always the same as in the whole manipulator and the the normal is given by the rotation axis (see setup()) in world space.

Reimplemented from Foundry::Katana::ViewerUtils::GLManipulatorHandle.

FnAttribute::Attribute GLRotateAxisHandle::getOption ( Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type  optionId) [virtual]

Gets the option given the option ID.

It has been overridden to disable hide the mouse pointer.

Reimplemented from Foundry::Katana::ViewerUtils::GLManipulatorHandle.

virtual Orientation GLRotateAxisHandle::getOrientation ( ) [inline, virtual]

Defines the orientation space of the manipulator.

This uses a "ManipulatorOrientation" option set on the Viewport that specifies the orientation for the manipulator. This option's value is an integer with the correspondent Orientation enum value.

Reimplemented from Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

void GLRotateAxisHandle::pickerDraw ( int64_t  pickerId) [virtual]

Draws the manipulator with a specific selection picker ID. Typically this id is converted to a color value, and the handle is then drawn with flat shading, so it can be identified in a look-up table.

Reimplemented from Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.

void GLRotateAxisHandle::setupViewHandle ( ) [inline]

Initializes the axis and meshes. Called at handle creation. This is a special setup function for a view handle that is always orientated towards the camera.

void GLRotateAxisHandle::startDrag ( const Vec3d initialPointOnPlane,
const Vec2i initialMousePosition 
) [protected, virtual]

Initializes the initial values for the pie slice and checks if the dragging should be orbital or linear.

Reimplemented from Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator