The MovableCoordinateFrame class. More...
#include <coordinateframe.h>
Public Member Functions | |
virtual void | AlignWith (const Point3f primary, const Point3f secondary, const char axis_1, const char axis_2) |
Align the coordinate frame to one or two directions. | |
virtual Point3f | GetPosition () |
Get the position of the coordinate frame. | |
virtual Quaternionf | GetRotation () |
Get the rotation of the coordinate frame. | |
virtual void | GetTransform (Matrix44f &m) |
Computes the transformation matrix relative to the current rototranslation. | |
MovableCoordinateFrame (float) | |
The constructor. | |
virtual void | Render (QGLWidget *glw) |
Render the movable coordinate frame in its position. | |
virtual void | Reset (bool reset_position, bool reset_alignment) |
Reset the position and/or the rotation of the coordinate frame. | |
virtual void | Rot (float angle, const Point3f axis) |
Rotates the coordinate frame wrt itself. | |
virtual void | SetPosition (const Point3f new_position) |
Set the position of the coordinate frame. | |
virtual void | SetRotation (const Quaternionf rotation) |
Set the rotation of the coordinate frame. | |
virtual | ~MovableCoordinateFrame () |
Protected Member Functions | |
virtual void | Move (const Similarityf) |
void | RotateToAlign (const Point3f, const Point3f) |
Protected Attributes | |
Point3f | position |
Quaternionf | rotation |
The MovableCoordinateFrame class.
This class extends the coordinate frame with the ability of being programmatically rototranslated.
Definition at line 127 of file coordinateframe.h.
MovableCoordinateFrame::MovableCoordinateFrame | ( | float | size | ) |
The constructor.
Initialize the MovableCoordinateFrame data.
size | the distance from the origin to the endpoint of the arrows. |
Definition at line 203 of file coordinateframe.cpp.
virtual vcg::MovableCoordinateFrame::~MovableCoordinateFrame | ( | ) | [inline, virtual] |
The destructor.
Definition at line 144 of file coordinateframe.h.
void MovableCoordinateFrame::AlignWith | ( | const Point3f | primary, | |
const Point3f | secondary, | |||
const char | axis_1, | |||
const char | axis_2 | |||
) | [virtual] |
Align the coordinate frame to one or two directions.
If the primary direction of alignment is null this function does nothing, otherwise two rotations are performed: the first rotation aligns the axis named axis_1 to the primary direction of alignment, the second rotation never moves axis_1 away from the primary direction.
If the secondary direction of alignment is not null and is not parallel to the primary direction the axis named axis_2 is rotated as much as possible to be aligned to secondary direction.
If the secondary direction of alignment is null the axis named axis_2 is rotated as much as possible to be realigned to its old direction, if this is impossible the remaining axis is used.
primary | the primary direction of alignment. | |
secondary | the secondary direction of alignment. | |
axis_1 | the name of the axis to align to the primary direction, must be a char choosen from 'X', 'Y' and 'Z' | |
axis_2 | the name of the axis to align to the secondary direction, must be different from axis_1 and must be a char choosen from 'X', 'Y', 'Z' and ' '; if the char is ' ' the axis is choosen automatically. |
Reimplemented in vcg::ActiveCoordinateFrame.
Definition at line 280 of file coordinateframe.cpp.
Point3f MovableCoordinateFrame::GetPosition | ( | ) | [virtual] |
Get the position of the coordinate frame.
Definition at line 263 of file coordinateframe.cpp.
Quaternionf MovableCoordinateFrame::GetRotation | ( | ) | [virtual] |
Get the rotation of the coordinate frame.
Definition at line 268 of file coordinateframe.cpp.
void MovableCoordinateFrame::GetTransform | ( | Matrix44f & | m | ) | [virtual] |
Computes the transformation matrix relative to the current rototranslation.
m | is set to the transformation matrix. |
Definition at line 224 of file coordinateframe.cpp.
void MovableCoordinateFrame::Move | ( | const Similarityf | track | ) | [protected, virtual] |
Reimplemented in vcg::ActiveCoordinateFrame.
Definition at line 340 of file coordinateframe.cpp.
void MovableCoordinateFrame::Render | ( | QGLWidget * | glw | ) | [virtual] |
Render the movable coordinate frame in its position.
glw | the GL widget. |
Reimplemented from vcg::CoordinateFrame.
Reimplemented in vcg::ActiveCoordinateFrame.
Definition at line 209 of file coordinateframe.cpp.
void MovableCoordinateFrame::Reset | ( | bool | reset_position, | |
bool | reset_alignment | |||
) | [virtual] |
Reset the position and/or the rotation of the coordinate frame.
reset_position | set to true to reset the position. | |
reset_alignment | set to true to reset the rotation. |
Reimplemented in vcg::ActiveCoordinateFrame.
Definition at line 245 of file coordinateframe.cpp.
void MovableCoordinateFrame::Rot | ( | float | angle, | |
const Point3f | axis | |||
) | [virtual] |
Rotates the coordinate frame wrt itself.
angle | the angle of the rotation, in degrees. | |
axis | the axis of the rotation. |
Definition at line 273 of file coordinateframe.cpp.
Definition at line 346 of file coordinateframe.cpp.
void MovableCoordinateFrame::SetPosition | ( | const Point3f | new_position | ) | [virtual] |
Set the position of the coordinate frame.
new_position | the new position of the coordinate frame. |
Reimplemented in vcg::ActiveCoordinateFrame.
Definition at line 253 of file coordinateframe.cpp.
void MovableCoordinateFrame::SetRotation | ( | const Quaternionf | rotation | ) | [virtual] |
Set the rotation of the coordinate frame.
new_rotation | the new rotation of the coordinate frame. |
Reimplemented in vcg::ActiveCoordinateFrame.
Definition at line 258 of file coordinateframe.cpp.
Point3f vcg::MovableCoordinateFrame::position [protected] |
Definition at line 222 of file coordinateframe.h.
Quaternionf vcg::MovableCoordinateFrame::rotation [protected] |
Definition at line 223 of file coordinateframe.h.