Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csReversibleTransform Class Reference

A class which defines a reversible transformation from one coordinate system to another by maintaining an inverse transformation matrix. More...

#include <transfrm.h>

Inheritance diagram for csReversibleTransform:

csTransform csOrthoTransform csCamera List of all members.

Public Methods

 csReversibleTransform ()
 Initialize with the identity transformation.

 csReversibleTransform (const csMatrix3 &o2t, const csVector3 &pos)
 Initialize with the given transformation. More...

 csReversibleTransform (const csTransform &t)
 Initialize with the given transformation.

 csReversibleTransform (const csReversibleTransform &t)
 Initialize with the given transformation.

const csMatrix3GetT2O () const
 Get 'this' to 'other' transformation matrix. More...

csVector3 GetT2OTranslation () const
 Get 'this' to 'other' translation. More...

csReversibleTransform GetInverse () const
 Get the inverse of this transform.

virtual void SetO2T (const csMatrix3 &m)
 Set 'other' to 'this' transformation matrix. More...

virtual void SetT2O (const csMatrix3 &m)
 Set 'this' to 'other' transformation matrix. More...

csVector3 This2Other (const csVector3 &v) const
 Convert vector v in 'this' space to 'other' space. More...

csVector3 This2OtherRelative (const csVector3 &v) const
 Convert vector v in 'this' space to a vector in 'other' space, relative to local origin. More...

csPlane3 This2Other (const csPlane3 &p) const
 Convert a plane in 'this' space to 'other' space. More...

csPlane3 This2OtherRelative (const csPlane3 &p) const
 Convert a plane in 'this' space to 'other' space. More...

void This2Other (const csPlane3 &p, const csVector3 &point, csPlane3 &result) const
 Convert a plane in 'this' space to 'other' space. More...

csSphere This2Other (const csSphere &s) const
 Convert a sphere in 'this' space to 'other' space.

void RotateOther (const csVector3 &v, float angle)
 Rotate the transform by the angle (radians) around the given vector, in other coordinates. More...

void RotateThis (const csVector3 &v, float angle)
 Rotate the transform by the angle (radians) around the given vector, in these coordinates. More...

void RotateOther (const csMatrix3 &m)
 Use the given transformation matrix, in other space, to reorient the transformation. More...

void RotateThis (const csMatrix3 &m)
 Use the given transformation matrix, in this space, to reorient the transformation. More...

void LookAt (const csVector3 &v, const csVector3 &up)
 Let this transform look at the given (x,y,z) point, using up as the up-vector. More...


Protected Methods

 csReversibleTransform (const csMatrix3 &o2t, const csMatrix3 &t2o, const csVector3 &pos)
 Initialize transform with both transform matrix and inverse tranform.


Protected Attributes

csMatrix3 m_t2o
 Inverse transformation matrix ('this' to 'other' space).


Friends

csVector3 operator/ (const csVector3 &v, const csReversibleTransform &t)
 Reverse a transformation on a 3D vector. More...

csVector3operator/= (csVector3 &v, const csReversibleTransform &t)
 Reverse a transformation on a 3D vector. More...

csPlane3 operator/ (const csPlane3 &p, const csReversibleTransform &t)
 Reverse a transformation on a Plane. More...

csPlane3operator/= (csPlane3 &p, const csReversibleTransform &t)
 Reverse a transformation on a Plane. More...

csSphere operator/ (const csSphere &p, const csReversibleTransform &t)
 Reverse a transformation on a sphere. More...

csReversibleTransform& operator *= (csReversibleTransform &t1, const csReversibleTransform &t2)
 Combine two transforms, rightmost first. More...

csReversibleTransform operator * (const csReversibleTransform &t1, const csReversibleTransform &t2)
 Combine two transforms, rightmost first. More...

csTransform operator * (const csTransform &t1, const csReversibleTransform &t2)
 Combine two transforms, rightmost first. More...

csReversibleTransform& operator/= (csReversibleTransform &t1, const csReversibleTransform &t2)
 Combine two transforms, reversing t2 then applying t1. More...

csReversibleTransform operator/ (const csReversibleTransform &t1, const csReversibleTransform &t2)
 Combine two transforms, reversing t2 then applying t1. More...


Detailed Description

A class which defines a reversible transformation from one coordinate system to another by maintaining an inverse transformation matrix.

This version is similar to csTransform (in fact, it is a sub-class) but it is more efficient if you plan to do inverse transformations often.


Constructor & Destructor Documentation

csReversibleTransform::csReversibleTransform ( const csMatrix3 & o2t,
const csVector3 & pos ) [inline]
 

Initialize with the given transformation.

The transformation is given as a 3x3 matrix and a vector. The transformation is defined to mean T=M*(O-V) with T the vector in 'this' space, O the vector in 'other' space, M the transformation matrix and V the transformation vector.


Member Function Documentation

const csMatrix3 & csReversibleTransform::GetT2O ( ) const [inline]
 

Get 'this' to 'other' transformation matrix.

This corresponds to the inverse of M.

csVector3 csReversibleTransform::GetT2OTranslation ( ) const [inline]
 

Get 'this' to 'other' translation.

This will calculate and return -(M*V).

void csReversibleTransform::LookAt ( const csVector3 & v,
const csVector3 & up )
 

Let this transform look at the given (x,y,z) point, using up as the up-vector.

'v' should be given relative to the position of the origin of this transform. For example, if the transform is located at pos=(3,1,9) and you want it to look at location loc=(10,2,8) while keeping the orientation so that the up-vector is upwards then you can use: LookAt (loc-pos, csVector3 (0, 1, 0)).

void csReversibleTransform::RotateOther ( const csMatrix3 & m ) [inline]
 

Use the given transformation matrix, in other space, to reorient the transformation.

Note: this function rotates the transformation, not the coordinate system. This basically calculates Minv=m*Minv (with Minv the inverse of M). M will be calculated accordingly.

void csReversibleTransform::RotateOther ( const csVector3 & v,
float angle )
 

Rotate the transform by the angle (radians) around the given vector, in other coordinates.

Note: this function rotates the transform, not the coordinate system.

void csReversibleTransform::RotateThis ( const csMatrix3 & m ) [inline]
 

Use the given transformation matrix, in this space, to reorient the transformation.

Note: this function rotates the transformation, not the coordinate system. This basically calculates Minv=Minv*m (with Minv the inverse of M). M will be calculated accordingly.

void csReversibleTransform::RotateThis ( const csVector3 & v,
float angle )
 

Rotate the transform by the angle (radians) around the given vector, in these coordinates.

Note: this function rotates the tranform, not the coordinate system.

void csReversibleTransform::SetO2T ( const csMatrix3 & m ) [inline, virtual]
 

Set 'other' to 'this' transformation matrix.

This is the 3x3 matrix M from the transform equation T=M*(O-V).

Reimplemented from csTransform.

Reimplemented in csCamera, and csOrthoTransform.

void csReversibleTransform::SetT2O ( const csMatrix3 & m ) [inline, virtual]
 

Set 'this' to 'other' transformation matrix.

This is equivalent to SetO2T() except that you can now give the inverse matrix.

Reimplemented in csCamera, and csOrthoTransform.

void csReversibleTransform::This2Other ( const csPlane3 & p,
const csVector3 & point,
csPlane3 & result ) const
 

Convert a plane in 'this' space to 'other' space.

This is an optimized version for which a point on the new plane is known (point). The result is stored in 'result'. If 'p' is expressed as (N,D) (with N a vector for the A,B,C components of 'p') then this will return a new plane which looks like (Minv*N,-(Minv*N)*point) (with Minv the inverse of M).

csPlane3 csReversibleTransform::This2Other ( const csPlane3 & p ) const
 

Convert a plane in 'this' space to 'other' space.

If 'p' is expressed as (N,D) (with N a vector for the A,B,C components of 'p') then this will return a new plane which looks like (Minv*N,D-N*(M*V)) (with Minv the inverse of M).

csVector3 csReversibleTransform::This2Other ( const csVector3 & v ) const [inline]
 

Convert vector v in 'this' space to 'other' space.

This is the basic inverse transform operation and it corresponds with the calculation of V+Minv*v (with Minv the inverse of M).

csPlane3 csReversibleTransform::This2OtherRelative ( const csPlane3 & p ) const
 

Convert a plane in 'this' space to 'other' space.

This version ignores translation. If 'p' is expressed as (N,D) (with N a vector for the A,B,C components of 'p') then this will return a new plane which looks like (Minv*N,D) (with Minv the inverse of M).

csVector3 csReversibleTransform::This2OtherRelative ( const csVector3 & v ) const [inline]
 

Convert vector v in 'this' space to a vector in 'other' space, relative to local origin.

This calculates and returns Minv*v (with Minv the inverse of M).


Friends And Related Function Documentation

csTransform operator * ( const csTransform & t1,
const csReversibleTransform & t2 ) [friend]
 

Combine two transforms, rightmost first.

Given the following definitions:

  • 't1' expressed as T=t1.M*(O-t1.V)
  • 't2' expressed as T=t2.M*(O-t2.V)
  • t1.Minv is the inverse of t1.M
  • t2.Minv is the inverse of t2.M
Then this will calculate a new transformation in 't1' as follows: T=(t1.M*t2.M)*(O-(t2.Minv*t1.V+t2.V)).

Reimplemented from csTransform.

csReversibleTransform operator * ( const csReversibleTransform & t1,
const csReversibleTransform & t2 ) [friend]
 

Combine two transforms, rightmost first.

Given the following definitions:

  • 't1' expressed as T=t1.M*(O-t1.V)
  • 't2' expressed as T=t2.M*(O-t2.V)
  • t1.Minv is the inverse of t1.M
  • t2.Minv is the inverse of t2.M
Then this will calculate a new transformation in 't1' as follows: T=(t1.M*t2.M)*(O-(t2.Minv*t1.V+t2.V)).

csReversibleTransform & operator *= ( csReversibleTransform & t1,
const csReversibleTransform & t2 ) [friend]
 

Combine two transforms, rightmost first.

Given the following definitions:

  • 't1' expressed as T=t1.M*(O-t1.V)
  • 't2' expressed as T=t2.M*(O-t2.V)
  • t1.Minv is the inverse of t1.M
  • t2.Minv is the inverse of t2.M
Then this will calculate a new transformation in 't1' as follows: T=(t1.M*t2.M)*(O-(t2.Minv*t1.V+t2.V)).

csReversibleTransform operator/ ( const csReversibleTransform & t1,
const csReversibleTransform & t2 ) [friend]
 

Combine two transforms, reversing t2 then applying t1.

Given the following definitions:

  • 't1' expressed as T=t1.M*(O-t1.V)
  • 't2' expressed as T=t2.M*(O-t2.V)
  • t1.Minv is the inverse of t1.M
  • t2.Minv is the inverse of t2.M
Then this will calculate a new transformation in 't1' as follows: T=(t1.M*t2.Minv)*(O-(t2.M*(t1.V-t2.V))).

csSphere operator/ ( const csSphere & p,
const csReversibleTransform & t ) [friend]
 

Reverse a transformation on a sphere.

This corresponds exactly to calling t.This2Other(p).

csPlane3 operator/ ( const csPlane3 & p,
const csReversibleTransform & t ) [friend]
 

Reverse a transformation on a Plane.

This corresponds exactly to calling t.This2Other(p).

csVector3 operator/ ( const csVector3 & v,
const csReversibleTransform & t ) [friend]
 

Reverse a transformation on a 3D vector.

This corresponds exactly to calling t.This2Other(v).

csReversibleTransform & operator/= ( csReversibleTransform & t1,
const csReversibleTransform & t2 ) [friend]
 

Combine two transforms, reversing t2 then applying t1.

Given the following definitions:

  • 't1' expressed as T=t1.M*(O-t1.V)
  • 't2' expressed as T=t2.M*(O-t2.V)
  • t1.Minv is the inverse of t1.M
  • t2.Minv is the inverse of t2.M
Then this will calculate a new transformation in 't1' as follows: T=(t1.M*t2.Minv)*(O-(t2.M*(t1.V-t2.V))).

csPlane3 & operator/= ( csPlane3 & p,
const csReversibleTransform & t ) [friend]
 

Reverse a transformation on a Plane.

This corresponds exactly to calling p = t.This2Other(p).

csVector3 & operator/= ( csVector3 & v,
const csReversibleTransform & t ) [friend]
 

Reverse a transformation on a 3D vector.

This corresponds exactly to calling v=t.This2Other(v).


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000