CODTransform Class

class CODTransform: public CObject

Two dimensional transformaion matrix. This is used to transform the vertices of components when moved, rotated or scaled.

Defined in: OdTransform.h

Coordinates (x,y) can be transformed using this matrix formula:

| x'| = | a b | * | x | + | c |
| y'| | d e | | y | | f |

Or, by forming one transformation matrix:

| x'| | a b c | | x |
| y'| = | d e f | * | y |
| 1 | | 0 0 1 | | 1 | <- we don't have a third dimension!

The middle matrix is what a CODTransform represents. Points in space are transformed by multiplying the matrix by the vector [point.x, point.y, 1]

See Also

ODMatrix3x2

Class Members

 CODTransform()

Constructor.

 CODTransform(const CODTransform& xform)

Copy constructor.

ODMatrix3x2  m_matrix

The float array that contains the matrix data.

void  Identity()

Sets this matrix to the identity matrix.

BOOL  IsIdentity()

Returns TRUE if this is an identity matirx.

float  GetElement(const int x, const int y) const

Constant method to retrieve a single element of the martix.

float&  GetElementRef(const int x, const int y)

Method to retrieve a reference to an element of the martix.

void  Translate(int nOffsetX, int nOffsetY)

Translates the matrix by horizontal and vertical offsets.

void  Translate(float fOffsetX, float fOffsetY)

Translates the matrix by horizontal and vertical offsets.

void  SetTranslation(const int nDistX, const int nDistY)

Sets the current translation from the origin.

void  GetTranslation(int& nDistX, int& nDistY)

Gets the current translation from the origin.

BOOL  IsTranslated()

Returns TRUE if the matrix has been translated from the origin.

void  Rotate(int nAngle)

Rotates the transform.

void  Rotate(int nAngle, float fOriginX, float fOriginY, CSize sizeAspectRatio = odg_sizeDefaultAspectRatio)

Rotates the transform, using the coordinates passed in as the origin.

int  GetRotation()

Gets the current rotation of the transform.

BOOL  IsRotated()

Returns TRUE if the transform rotated.

void  Scale(float fScaleX, float fScaleY)

Scales the transform.

void  Scale(float fScaleX, float fScaleY, float fOriginX, float fOriginY)

Scales the transform, using the coordinates passed in as the origin.

void  GetScaling(float& fScaleX, float& fScaleY)

Gets the current scaling factors of the transform.

BOOL  IsScaled()

Returns TRUE if the transform has been scaled.

BOOL  IsStretched()

Returns TRUE if the transform has been stretched out of proportion.

 operator XFORM()

Cast to an XFORM structure.

ODVector2&  operator[](const int x)

Returns the vector at the supplied x position.

CODTransform&  operator=(const CODTransform& xform)

Sets this transform equal to another transform.

BOOL  operator==(const CODTransform& xform) const

Tests for equality against another transform.

BOOL  operator!=(const CODTransform& xform) const

Tests for inequality against another transform.

CODTransform  operator+(const CODTransform& xform) const

Calculates the addition of another transform to this one.

CODTransform  operator-(const CODTransform& xform) const

Calculates the subtraction of another transform from this one.

CODTransform  operator*(const CODTransform& xform) const

Calculates the multiplication of another transform with this one.

CODTransform&  operator+=(const CODTransform& xform)

Adds the values of another transform to this one.

CODTransform&  operator-=(const CODTransform& xform)

Subtracts the values of another transform from this one.

CODTransform&  operator*=(const CODTransform& xform)

Multiplies another transformation matrix with this one.

float  Det()

Calculates the determinant of the transformation matrix.

CPoint  TransformPoint(CPoint point)

Transforms a CPoint.

void  TransformPoint(float& x, float& y)

Transforms floating point X and Y values.

void  TransformPoints(LPPOINT lpPoints, int nCount)

Transforms an array of points.

void  TransformPoints(LPPOINT lpBefore, LPPOINT lpAfter, int nCount)

Transforms an array of points, placing the result in another array.

CPoint  InvTransformPoint(CPoint point)

Performs an inverse transform on a CODPoint.

void  InvTransformPoints(LPPOINT lpPoints, int nCount)

Performs an inverse transform on an array of points.

void  InvTransformPoints(LPPOINT lpBefore, LPPOINT lpAfter, int nCount)

Performs an inverse transform on an array of points, placing the result in another array.

virtual void  Serialize(CArchive& ar)

Serializes the line properties.