Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

base::Orient Class Reference

Orientation in 3D. More...

Collaboration diagram for base::Orient:

Collaboration graph
[legend]
List of all members.

Public Types

typedef Byte Representation

Public Member Functions

 Orient ()
 construct a zero orientation. (like the identify transform - defaults to EulerRPY vector 0)

 Orient (Representation representation)
 construct a zero orientation. (like the identify transform)

 Orient (const Quat4 &q)
 construct from a quaternion (x,y,z,w)

 Orient (Real roll, Real pitch, Real yaw)
 construct from EulerRPY

 Orient (const Vector &v, Representation representation=EulerRPY)
 construct from a Vector.

 Orient (const Matrix3 &m3)
 construct from a 3x3 rotation transformation matrix

 Orient (const Matrix &m)
 construct from a 3x3 rotation transformation matrix

 Orient (const Orient &copy)
 ~Orient ()
Representation representation () const
bool isEuler () const
Int size () const
Realoperator[] (Int i)
const Realoperator[] (Int i) const
Orientoperator= (const Quat4 &q)
Orientoperator= (const Matrix3 &mt)
Orientoperator= (const Orient &copy) throw ()
void setIdentity (Representation representation=Quat)
void setFromRotationComponent (const Matrix4 &mt)
bool operator== (const Orient &o) const throw ()
 equality.

bool operator!= (const Orient &o) const throw ()
bool equals (const Orient &o, Real epsilon=consts::epsilon) const throw ()
void rotatePoint (Point3 &p) const
Point3 rotate (const Point3 &p) const
void rotatePoint (Point4 &p) const
Point4 rotate (const Point4 &p) const
Orientinvert ()
 invert the rotation (i.e. switch to the reverse rotation)

Matrix getRotationMatrix () const
Matrix3 getRotationMatrix3 () const
Quat4 getQuat4 () const
Vector getVector (Representation representation) const
Vector3 getVector3 (Representation representation) const
 operator Vector () const
 automatic conversion to a Vector

 operator Matrix3 () const
 automatic conversion to a rotation matrix

 operator Quat4 () const
 automatic conversion to a Quat4

void changeRepresentation (Representation newRepresentation)
 request change the internal representation (which may or may not be honored)

Matrix getBinv () const
 returns the inverse of B, such that omega = B(v)^-1 . dv/dt, where omega is angular velocity and v is this orientation

void serialize (Serializer &s)
 read or write object state to Serializer


Static Public Member Functions

String representationString (Representation rep)
bool isEuler (Representation rep)
Int size (Representation rep)
Orient interpolate (const Orient &lower, const Orient &upper, Real t)
 interpolate between the orientations lower and upper t:[0..1]


Static Public Attributes

const Representation EulerXYZs
const Representation EulerXYXs
const Representation EulerXZYs
const Representation EulerXZXs
const Representation EulerYZXs
const Representation EulerYZYs
const Representation EulerYXZs
const Representation EulerYXYs
const Representation EulerZXYs
const Representation EulerZXZs
const Representation EulerZYXs
const Representation EulerZYZs
const Representation EulerZYXr
const Representation EulerXYXr
const Representation EulerYZXr
const Representation EulerXZXr
const Representation EulerXZYr
const Representation EulerYZYr
const Representation EulerZXYr
const Representation EulerYXYr
const Representation EulerYXZr
const Representation EulerZXZr
const Representation EulerXYZr
const Representation EulerZYZr
const Representation LastEuler = 23
const Representation EulerRPY
const Representation Quat = 24
const Representation Mat = 25
const Representation Rodriguez = 26
const Representation RepEnd = 27

Protected Types

typedef MatrixMatrixRef
enum  Axis { X = 0, Y = 1, Z = 2, W = 3 }
enum  Frame { Static = 0, Rotating = 1 }
enum  Repetition { NonRepeating = 0, Repeating = 1 }
enum  Parity { Even = 0, Odd = 1 }

Protected Member Functions

void changeRep (Representation newRep) const
 change the current internal representation to that specified.


Static Protected Member Functions

Representation eulerRep (Axis axis, Parity parity, Repetition repetition, Frame frame)
Frame frame (Representation rep)
Repetition repetition (Representation rep)
Parity parity (Representation rep)
Axis axisI (Representation rep)
Axis axisJ (Representation rep)
Axis axisK (Representation rep)
Axis axisH (Representation rep)
void getRep (Representation rep, Axis &i, Axis &j, Axis &k, Axis &h, Parity &n, Repetition &s, Frame &f)

Protected Attributes

Representation rep
Vector v
 component of vector-based representations (Quat, Euler, etc.)

MatrixRef m
 Matrix(3,3) ref if rep==Mat.


Static Protected Attributes

Byte EulSafe [4]
Byte EulNext [4]

Friends

std::ostream & operator<< (std::ostream &out, const Orient &o)

Detailed Description

Orientation in 3D.

Represents an orientation in 3D using various internal representations.

There are many parameterizations and terms in use for rotations and orientation/attitude. Some of the more common are:

Todo:
finish implementing and testing this class!

Definition at line 93 of file Orient.


Member Typedef Documentation

typedef Matrix* base::Orient::MatrixRef [protected]
 

Definition at line 311 of file Orient.

typedef Byte base::Orient::Representation
 

Quat - Euler parameters expressed as a quaternion (v.x,v.y,v.z,w) Mat - 3x3 transformation matrix of direction cosines. EulerABC - Euler (possibly Cardan-Bryant) angles about the axes A, B & C in that order. EulerRPY - Euler (Cardan-Bryant) Roll, Pitch, Yaw angles (alpha,beta,gamma). This is equivelent to EulerXYZ and assumes that the x-axis points forward, y-axis points right and the z-axis up. (Aeronautical convention) Euler - alias for EulerZXZ Rodriguez - Rodriguez parameters (gamma1, gamma2, gamma3)

Definition at line 108 of file Orient.

Referenced by axisH(), axisI(), axisJ(), axisK(), changeRepresentation(), eulerRep(), frame(), getRep(), isEuler(), parity(), repetition(), representation(), and size().


Member Enumeration Documentation

enum base::Orient::Axis [protected]
 

Enumeration values:
X 
Y 
Z 
W 

Definition at line 314 of file Orient.

Referenced by axisH(), axisI(), axisJ(), axisK(), and getRep().

enum base::Orient::Frame [protected]
 

Enumeration values:
Static 
Rotating 

Definition at line 315 of file Orient.

Referenced by frame(), and getRep().

enum base::Orient::Parity [protected]
 

Enumeration values:
Even 
Odd 

Definition at line 317 of file Orient.

Referenced by getRep(), and parity().

enum base::Orient::Repetition [protected]
 

Enumeration values:
NonRepeating 
Repeating 

Definition at line 316 of file Orient.

Referenced by getRep(), and repetition().


Constructor & Destructor Documentation

base::Orient::Orient  ) 
 

construct a zero orientation. (like the identify transform - defaults to EulerRPY vector 0)

base::Orient::Orient Representation  representation  ) 
 

construct a zero orientation. (like the identify transform)

base::Orient::Orient const Quat4 q  ) 
 

construct from a quaternion (x,y,z,w)

base::Orient::Orient Real  roll,
Real  pitch,
Real  yaw
 

construct from EulerRPY

base::Orient::Orient const Vector v,
Representation  representation = EulerRPY
[explicit]
 

construct from a Vector.

base::Orient::Orient const Matrix3 m3  ) 
 

construct from a 3x3 rotation transformation matrix

base::Orient::Orient const Matrix m  ) 
 

construct from a 3x3 rotation transformation matrix

base::Orient::Orient const Orient copy  ) 
 

base::Orient::~Orient  ) 
 


Member Function Documentation

Axis base::Orient::axisH Representation  rep  )  [inline, static, protected]
 

Definition at line 329 of file Orient.

References Axis, axisI(), axisK(), NonRepeating, repetition(), and Representation.

Axis base::Orient::axisI Representation  rep  )  [inline, static, protected]
 

Definition at line 326 of file Orient.

References Axis, base::Byte, EulSafe, and Representation.

Referenced by axisH(), axisJ(), and axisK().

Axis base::Orient::axisJ Representation  rep  )  [inline, static, protected]
 

Definition at line 327 of file Orient.

References Axis, axisI(), base::Byte, EulNext, Odd, parity(), and Representation.

Axis base::Orient::axisK Representation  rep  )  [inline, static, protected]
 

Definition at line 328 of file Orient.

References Axis, axisI(), base::Byte, EulNext, Odd, parity(), and Representation.

Referenced by axisH().

void base::Orient::changeRep Representation  newRep  )  const [protected]
 

change the current internal representation to that specified.

Referenced by changeRepresentation().

void base::Orient::changeRepresentation Representation  newRepresentation  )  [inline]
 

request change the internal representation (which may or may not be honored)

Definition at line 299 of file Orient.

References changeRep(), and Representation.

bool base::Orient::equals const Orient o,
Real  epsilon = consts::epsilon
const throw ()
 

Representation base::Orient::eulerRep Axis  axis,
Parity  parity,
Repetition  repetition,
Frame  frame
[inline, static, protected]
 

Definition at line 319 of file Orient.

References base::Byte, and Representation.

Frame base::Orient::frame Representation  rep  )  [inline, static, protected]
 

Definition at line 322 of file Orient.

References base::Byte, Frame, and Representation.

Matrix base::Orient::getBinv  )  const
 

returns the inverse of B, such that omega = B(v)^-1 . dv/dt, where omega is angular velocity and v is this orientation

Quat4 base::Orient::getQuat4  )  const
 

Referenced by operator Quat4(), rotate(), base::LineSegPathRep::rotate(), rotatePoint(), and base::LineSegPathRep::transform().

void base::Orient::getRep Representation  rep,
Axis i,
Axis j,
Axis k,
Axis h,
Parity n,
Repetition s,
Frame f
[inline, static, protected]
 

Definition at line 330 of file Orient.

References Axis, base::Byte, EulNext, EulSafe, f, Frame, Parity, Repetition, and Representation.

Matrix base::Orient::getRotationMatrix  )  const
 

Matrix3 base::Orient::getRotationMatrix3  )  const
 

Referenced by operator Matrix3().

Vector base::Orient::getVector Representation  representation  )  const
 

Referenced by operator Vector().

Vector3 base::Orient::getVector3 Representation  representation  )  const
 

Orient base::Orient::interpolate const Orient lower,
const Orient upper,
Real  t
[static]
 

interpolate between the orientations lower and upper t:[0..1]

Orient& base::Orient::invert  ) 
 

invert the rotation (i.e. switch to the reverse rotation)

bool base::Orient::isEuler  )  const [inline]
 

Definition at line 179 of file Orient.

References LastEuler, and rep.

bool base::Orient::isEuler Representation  rep  )  [inline, static]
 

Definition at line 178 of file Orient.

References LastEuler, and Representation.

base::Orient::operator Matrix3  )  const [inline]
 

automatic conversion to a rotation matrix

Definition at line 290 of file Orient.

References getRotationMatrix3().

base::Orient::operator Quat4  )  const [inline]
 

automatic conversion to a Quat4

Definition at line 294 of file Orient.

References getQuat4().

base::Orient::operator Vector  )  const [inline]
 

automatic conversion to a Vector

Definition at line 286 of file Orient.

References getVector(), Mat, and rep.

bool base::Orient::operator!= const Orient o  )  const throw () [inline]
 

Definition at line 239 of file Orient.

References operator==().

Orient& base::Orient::operator= const Orient copy  )  throw ()
 

Orient& base::Orient::operator= const Matrix3 mt  ) 
 

Orient& base::Orient::operator= const Quat4 q  )  [inline]
 

Definition at line 216 of file Orient.

References Mat, Quat, rep, base::vector< T >::resize(), base::Quat4::v, base::Quat4::w, base::Vector3::x, base::Vector3::y, and base::Vector3::z.

bool base::Orient::operator== const Orient o  )  const throw ()
 

equality.

NB: expensive if representations are not the same (conversion attempted)

Referenced by operator!=().

const Real& base::Orient::operator[] Int  i  )  const [inline]
 

Definition at line 205 of file Orient.

References base::Int, Mat, base::Real, and rep.

Real& base::Orient::operator[] Int  i  )  [inline]
 

Definition at line 194 of file Orient.

References base::Int, Mat, base::Real, and rep.

Parity base::Orient::parity Representation  rep  )  [inline, static, protected]
 

Definition at line 324 of file Orient.

References base::Byte, Parity, and Representation.

Referenced by axisJ(), and axisK().

Repetition base::Orient::repetition Representation  rep  )  [inline, static, protected]
 

Definition at line 323 of file Orient.

References base::Byte, Repetition, and Representation.

Referenced by axisH().

Representation base::Orient::representation  )  const [inline]
 

Definition at line 174 of file Orient.

References rep, and Representation.

String base::Orient::representationString Representation  rep  )  [static]
 

Point4 base::Orient::rotate const Point4 p  )  const [inline]
 

Definition at line 264 of file Orient.

References getQuat4(), base::Point4, and base::Quat4::rotate().

Point3 base::Orient::rotate const Point3 p  )  const [inline]
 

Definition at line 252 of file Orient.

References getQuat4(), base::Point3, and base::Quat4::rotate().

void base::Orient::rotatePoint Point4 p  )  const [inline]
 

Definition at line 258 of file Orient.

References getQuat4(), base::Point4, and base::Quat4::rotatePoint().

void base::Orient::rotatePoint Point3 p  )  const [inline]
 

Definition at line 246 of file Orient.

References getQuat4(), base::Point3, and base::Quat4::rotatePoint().

void base::Orient::serialize Serializer s  ) 
 

read or write object state to Serializer

Referenced by base::Serializer::operator()().

void base::Orient::setFromRotationComponent const Matrix4 mt  ) 
 

Referenced by base::Transform::getRotation().

void base::Orient::setIdentity Representation  representation = Quat  ) 
 

Referenced by base::Transform::getRotation().

Int base::Orient::size  )  const [inline]
 

Definition at line 188 of file Orient.

References base::Int, and rep.

Int base::Orient::size Representation  rep  )  [inline, static]
 

Definition at line 181 of file Orient.

References base::Int, Mat, Quat, and Representation.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  out,
const Orient o
[friend]
 

Definition at line 358 of file Orient.


Member Data Documentation

const Representation base::Orient::EulerRPY [static]
 

Definition at line 140 of file Orient.

const Representation base::Orient::EulerXYXr [static]
 

Definition at line 126 of file Orient.

const Representation base::Orient::EulerXYXs [static]
 

Definition at line 113 of file Orient.

const Representation base::Orient::EulerXYZr [static]
 

Definition at line 135 of file Orient.

const Representation base::Orient::EulerXYZs [static]
 

Definition at line 112 of file Orient.

const Representation base::Orient::EulerXZXr [static]
 

Definition at line 128 of file Orient.

const Representation base::Orient::EulerXZXs [static]
 

Definition at line 115 of file Orient.

const Representation base::Orient::EulerXZYr [static]
 

Definition at line 129 of file Orient.

const Representation base::Orient::EulerXZYs [static]
 

Definition at line 114 of file Orient.

const Representation base::Orient::EulerYXYr [static]
 

Definition at line 132 of file Orient.

const Representation base::Orient::EulerYXYs [static]
 

Definition at line 119 of file Orient.

const Representation base::Orient::EulerYXZr [static]
 

Definition at line 133 of file Orient.

const Representation base::Orient::EulerYXZs [static]
 

Definition at line 118 of file Orient.

const Representation base::Orient::EulerYZXr [static]
 

Definition at line 127 of file Orient.

const Representation base::Orient::EulerYZXs [static]
 

Definition at line 116 of file Orient.

const Representation base::Orient::EulerYZYr [static]
 

Definition at line 130 of file Orient.

const Representation base::Orient::EulerYZYs [static]
 

Definition at line 117 of file Orient.

const Representation base::Orient::EulerZXYr [static]
 

Definition at line 131 of file Orient.

const Representation base::Orient::EulerZXYs [static]
 

Definition at line 120 of file Orient.

const Representation base::Orient::EulerZXZr [static]
 

Definition at line 134 of file Orient.

const Representation base::Orient::EulerZXZs [static]
 

Definition at line 121 of file Orient.

const Representation base::Orient::EulerZYXr [static]
 

Definition at line 125 of file Orient.

const Representation base::Orient::EulerZYXs [static]
 

Definition at line 122 of file Orient.

const Representation base::Orient::EulerZYZr [static]
 

Definition at line 136 of file Orient.

const Representation base::Orient::EulerZYZs [static]
 

Definition at line 123 of file Orient.

Byte base::Orient::EulNext[4] [static, protected]
 

Definition at line 345 of file Orient.

Referenced by axisJ(), axisK(), and getRep().

Byte base::Orient::EulSafe[4] [static, protected]
 

Definition at line 344 of file Orient.

Referenced by axisI(), and getRep().

const Representation base::Orient::LastEuler = 23 [static]
 

Definition at line 138 of file Orient.

Referenced by isEuler().

MatrixRef base::Orient::m [mutable, protected]
 

Matrix(3,3) ref if rep==Mat.

Definition at line 312 of file Orient.

Referenced by base::operator<<().

const Representation base::Orient::Mat = 25 [static]
 

Definition at line 143 of file Orient.

Referenced by operator Vector(), operator=(), operator[](), and size().

const Representation base::Orient::Quat = 24 [static]
 

Definition at line 142 of file Orient.

Referenced by operator=(), and size().

Representation base::Orient::rep [mutable, protected]
 

Definition at line 309 of file Orient.

Referenced by isEuler(), operator Vector(), base::operator<<(), operator=(), operator[](), representation(), and size().

const Representation base::Orient::RepEnd = 27 [static]
 

Definition at line 145 of file Orient.

const Representation base::Orient::Rodriguez = 26 [static]
 

Definition at line 144 of file Orient.

Vector base::Orient::v [mutable, protected]
 

component of vector-based representations (Quat, Euler, etc.)

Definition at line 310 of file Orient.

Referenced by base::operator<<().


The documentation for this class was generated from the following file:
Generated on Thu Jul 29 16:38:51 2004 for OpenSim by doxygen 1.3.6