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
Class Members
VIEWS_API CODTransform()
Constructor.
VIEWS_API CODTransform(const CODTransform& xform)
Copy constructor.
ODMatrix3x2 m_matrix
The float array that contains the matrix data.
VIEWS_API void Identity()
Sets this matrix to the identity matrix.
VIEWS_API BOOL IsIdentity()
Returns TRUE if this is an identity matirx.
VIEWS_API float GetElement(const int x, const int y) const
Constant method to retrieve a single element of the martix.
VIEWS_API float& GetElementRef(const int x, const int y)
Method to retrieve a reference to an element of the martix.
VIEWS_API void Translate(int nOffsetX, int nOffsetY)
Translates the matrix by horizontal and vertical offsets.
VIEWS_API void Translate(float fOffsetX, float fOffsetY)
Translates the matrix by horizontal and vertical offsets.
VIEWS_API void SetTranslation(const int nDistX, const int nDistY)
Sets the current translation from the origin.
VIEWS_API void GetTranslation(int& nDistX, int& nDistY)
Gets the current translation from the origin.
VIEWS_API BOOL IsTranslated()
Returns TRUE if the matrix has been translated from the origin.
VIEWS_API void Rotate(int nAngle)
Rotates the transform.
VIEWS_API void Rotate(int nAngle, float fOriginX, float fOriginY, CSize sizeAspectRatio = odg_sizeDefaultAspectRatio)
Rotates the transform, using the coordinates passed in as the origin.
VIEWS_API int GetRotation()
Gets the current rotation of the transform.
VIEWS_API BOOL IsRotated()
Returns TRUE if the transform rotated.
VIEWS_API void Scale(float fScaleX, float fScaleY)
Scales the transform.
VIEWS_API void Scale(float fScaleX, float fScaleY, float fOriginX, float fOriginY)
Scales the transform, using the coordinates passed in as the origin.
VIEWS_API void GetScaling(float& fScaleX, float& fScaleY)
Gets the current scaling factors of the transform.
VIEWS_API BOOL IsScaled()
Returns TRUE if the transform has been scaled.
VIEWS_API BOOL IsStretched()
Returns TRUE if the transform has been stretched out of proportion.
VIEWS_API operator XFORM()
Cast to an XFORM structure.
VIEWS_API ODVector2& operator[](const int x)
Returns the vector at the supplied x position.
VIEWS_API CODTransform& operator=(const CODTransform& xform)
Sets this transform equal to another transform.
VIEWS_API BOOL operator==(const CODTransform& xform) const
Tests for equality against another transform.
VIEWS_API BOOL operator!=(const CODTransform& xform) const
Tests for inequality against another transform.
VIEWS_API CODTransform operator+(const CODTransform& xform) const
Calculates the addition of another transform to this one.
VIEWS_API CODTransform operator-(const CODTransform& xform) const
Calculates the subtraction of another transform from this one.
VIEWS_API CODTransform operator*(const CODTransform& xform) const
Calculates the multiplication of another transform with this one.
VIEWS_API CODTransform& operator+=(const CODTransform& xform)
Adds the values of another transform to this one.
VIEWS_API CODTransform& operator-=(const CODTransform& xform)
Subtracts the values of another transform from this one.
VIEWS_API CODTransform& operator*=(const CODTransform& xform)
Multiplies another transformation matrix with this one.
VIEWS_API float Det()
Calculates the determinant of the transformation matrix.
VIEWS_API CPoint TransformPoint(CPoint point)
Transforms a CPoint.
VIEWS_API void TransformPoint(float& x, float& y)
Transforms floating point X and Y values.
VIEWS_API void TransformPoints(LPPOINT lpPoints, int nCount)
Transforms an array of points.
VIEWS_API void TransformPoints(LPPOINT lpBefore, LPPOINT lpAfter, int nCount)
Transforms an array of points, placing the result in another array.
VIEWS_API CPoint InvTransformPoint(CPoint point)
Performs an inverse transform on a CODPoint.
VIEWS_API void InvTransformPoints(LPPOINT lpPoints, int nCount)
Performs an inverse transform on an array of points.
VIEWS_API void InvTransformPoints(LPPOINT lpBefore, LPPOINT lpAfter, int nCount)
Performs an inverse transform on an array of points, placing the result in another array.
VIEWS_API virtual void Serialize(CArchive& ar)
Serializes the line properties.