Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
csTransform Class Reference

#include <optransfrm.h>

Inheritance diagram for csTransform:
csReversibleTransform csOrthoTransform

Public Member Functions

 csTransform ()
 
 csTransform (const csMatrix3 &other2this, const csVector3 &origin_pos)
 
const csMatrix3GetO2T () const
 
const csVector3GetO2TTranslation () const
 
const csVector3GetOrigin () const
 
virtual void SetO2T (const csMatrix3 &m)
 
virtual void SetO2TTranslation (const csVector3 &v)
 
void SetOrigin (const csVector3 &v)
 
void Translate (const csVector3 &v)
 
csVector3 Other2This (const csVector3 &v) const
 
csVector3 Other2ThisRelative (const csVector3 &v) const
 

Protected Attributes

csMatrix3 m_o2t
 Transformation matrix from 'other' space to 'this' space. More...
 
csVector3 v_o2t
 Location of the origin for 'this' space. More...
 

Friends

csVector3 operator* (const csVector3 &v, const csTransform &t)
 
csVector3 operator* (const csTransform &t, const csVector3 &v)
 Apply a transformation to a 3D vector. More...
 
csVector3operator*= (csVector3 &v, const csTransform &t)
 Apply a transformation to a 3D vector. More...
 
csMatrix3 operator* (const csMatrix3 &m, const csTransform &t)
 Apply a transformation to a Plane. More...
 
csMatrix3 operator* (const csTransform &t, const csMatrix3 &m)
 Multiply a matrix with the transformation matrix. More...
 
csMatrix3operator*= (csMatrix3 &m, const csTransform &t)
 Multiply a matrix with the transformation matrix. More...
 
csTransform operator* (const csTransform &t1, const csReversibleTransform &t2)
 Combine two transforms, rightmost first. More...
 

Detailed Description

A class which defines a transformation from one coordinate system to another. The two coordinate systems are refered to as 'other' and 'this'. The transform defines a transformation from 'other' to 'this'.

Definition at line 33 of file optransfrm.h.

Constructor & Destructor Documentation

csTransform::csTransform ( )
inline

Initialize with the identity transformation.

Definition at line 45 of file optransfrm.h.

45 : m_o2t (), v_o2t (0, 0, 0) {}
csTransform::csTransform ( const csMatrix3 other2this,
const csVector3 origin_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.

Definition at line 54 of file optransfrm.h.

54  :
55  m_o2t (other2this), v_o2t (origin_pos) {}

Member Function Documentation

const csMatrix3& csTransform::GetO2T ( ) const
inline

Get 'other' to 'this' transformation matrix. This is the 3x3 matrix M from the transform equation T=M*(O-V).

Definition at line 61 of file optransfrm.h.

References m_o2t.

61 { return m_o2t; }
const csVector3& csTransform::GetO2TTranslation ( ) const
inline

Get 'world' to 'this' translation. This is the vector V from the transform equation T=M*(O-V).

Definition at line 67 of file optransfrm.h.

References v_o2t.

Referenced by csOPCODECollider::Collide().

67 { return v_o2t; }
const csVector3& csTransform::GetOrigin ( ) const
inline

Get origin of transformed coordinate system.

Definition at line 72 of file optransfrm.h.

References v_o2t.

72 { return v_o2t; }
csVector3 csTransform::Other2This ( const csVector3 v) const
inline

Transform vector in 'other' space v to a vector in 'this' space. This is the basic transform function.

Definition at line 100 of file optransfrm.h.

References m_o2t, and v_o2t.

101  {
102  return m_o2t * (v - v_o2t);
103  }
csVector3 csTransform::Other2ThisRelative ( const csVector3 v) const
inline

Convert vector v in 'other' space to a vector in 'this' space. Use the origin of 'other' space.

Definition at line 109 of file optransfrm.h.

References m_o2t, and v.

110  { return m_o2t * v; }
virtual void csTransform::SetO2T ( const csMatrix3 m)
inlinevirtual

Set 'other' to 'this' transformation matrix. this is the 3x3 matrix M from the transform equation T=M*(O-V).

Reimplemented in csOrthoTransform, and csReversibleTransform.

Definition at line 78 of file optransfrm.h.

References m_o2t.

78 { m_o2t = m; }
virtual void csTransform::SetO2TTranslation ( const csVector3 v)
inlinevirtual

Set 'world' to 'this' translation. This is the vector V from the transform equation T=M*(O-V).

Definition at line 84 of file optransfrm.h.

References v, and v_o2t.

Referenced by Unit::InsideCollideTree(), SetOrigin(), and Translate().

84 { v_o2t = v; }
void csTransform::SetOrigin ( const csVector3 v)
inline

Set origin of transformed coordinate system.

Definition at line 89 of file optransfrm.h.

References SetO2TTranslation().

89 { SetO2TTranslation (v); }
void csTransform::Translate ( const csVector3 v)
inline

Move the 'other' to 'this' translation by a specified amount.

Definition at line 94 of file optransfrm.h.

References SetO2TTranslation(), and v_o2t.

94 { SetO2TTranslation (v_o2t + v); }

Friends And Related Function Documentation

csVector3 operator* ( const csVector3 v,
const csTransform t 
)
friend

Convert a plane in 'other' space to 'this' space. Convert a plane in 'other' space to 'this' space. This version ignores translation. Convert a plane in 'other' space to 'this' space. This is an optimized version for which a point on the new plane is known (point). The result is stored in 'result'. Apply a transformation to a 3D vector.

csVector3 operator* ( const csTransform t,
const csVector3 v 
)
friend

Apply a transformation to a 3D vector.

csMatrix3 operator* ( const csMatrix3 m,
const csTransform t 
)
friend

Apply a transformation to a Plane.

Apply a transformation to a Plane. Apply a transformation to a Plane. Multiply a matrix with the transformation matrix.

csMatrix3 operator* ( const csTransform t,
const csMatrix3 m 
)
friend

Multiply a matrix with the transformation matrix.

csTransform operator* ( const csTransform t1,
const csReversibleTransform t2 
)
friend

Combine two transforms, rightmost first.

csVector3& operator*= ( csVector3 v,
const csTransform t 
)
friend

Apply a transformation to a 3D vector.

csMatrix3& operator*= ( csMatrix3 m,
const csTransform t 
)
friend

Multiply a matrix with the transformation matrix.

Member Data Documentation


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