All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
kjb::Rotation_axis Class Reference

#include <g2_rotation.h>

Public Member Functions

 Rotation_axis (const Vector &pt, const Vector &dir)
Vector rotate (const Vector &pt, double angle) const
Matrix get_transformation_matrix (double a) const

Detailed Description

This class facilitates rotating around an arbitrary axis, not necesarilly through the origin. Unlike quaternions, which are pure rotations, this operation generally involves translation to the origin, rotation, and translation back.

Currently, this class is quite thin, and it provides no value caching like quaternion does. Multiple calls to get_rotation_matrix() will recompute every time.

Constructor & Destructor Documentation

kjb::Rotation_axis::Rotation_axis ( const Vector pt,
const Vector dir 

Create from a rotation axis line. Line is represented in vector form:

l(t) = p + t * dir

ptA point lying on the rotation axis. Must have size = 3.
dirThe direction of the rotation axis. Must have size = 3.

Member Function Documentation

Matrix kjb::Rotation_axis::get_transformation_matrix ( double  a) const

Get the rigid transformation matrix that rotates by a degrees around this axis.

No values are cached, so multiple calls to this will re-compute the matrix.
Vector kjb::Rotation_axis::rotate ( const Vector pt,
double  angle 
) const

Rotate a point around this axis.

  • pt The point to rotate. Must have size = 3.
  • angle The angle (in radians) to rotate about the axis.

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