Class TMatrix2D (unit Matrix2D)

Inherits from

TObject

****** * * Module: Matrix2D * Author: Joe Kessler * IntegrationWare - A New Generation of Extraordinary PC Solutions * www.integrationware.com * * Purpose: * * This module encapsulates scaling, rotation, and movement of vertices * using 2-dimensional matrix math. * ******

Constructors


constructor Create;



Functions

function bAppearanceChanged: Boolean;

Check if the position has changed.

function bTransformChanged: Boolean;

Method to determine if the matrix has changed.

function bTranslateChanged: Boolean;

Check if the orientation of scaling has changed.

procedure ConstructMatrix;

Method for refreshing the matrix with current values.

procedure RecordMatrixState;

Check if the position, orientation, or scaling has changed.

procedure Reset;

Methods for operating upon the matrix.

procedure SetTranslation(iX, iY: Real);

Reset master matrix to an identity state.

procedure TransformVertex(fInputX, fInputY: Real; var fOutputX, fOutputY: Real);

Method for transforming a single vertex through the matrix.

procedure TranslateVertex(fInputX, fInputY: Real; var fOutputX, fOutputY: Real);

Method for translating a local vertex to a new scaling system.

function fGetTranslationX: Real;

Initialize the scaling matrix.

function fGetTranslationY: Real;


procedure SetOrientation(fRadians: Real);

Methods for getting/setting property values.

procedure SetScale(fScale: Real);

Initialize the rotation matrix.

procedure SetTranslationX(iX: Real);

Record the new translation values.

procedure SetTranslationY(iY: Real);

Record the new translation values.

Properties

property fOrientation : Real

Exposed properties.

property fScale : Real


property fTranslationX : Real


property fTranslationY : Real


Events

Variables

m_afMasterMatrix : array[0..2, 0..2] of Real;

Master tranformation matrix.

m_afRotationMatrix : array[0..2, 0..2] of Real;


m_afScalingMatrix : array[0..2, 0..2] of Real;

Scaling and rotation matrices.

m_bMatrixInitialized : Boolean;

TRUE when the matrix has been initialized.

m_fLastOrientation : Real;


m_fLastScale : Real;


m_fLastTranslationX : Real;

Previous transformation values.

m_fLastTranslationY : Real;


m_fOrientation : Real;


m_fScale : Real;


m_fTranslationX : Real;

Current Transformation Values.

m_fTranslationY : Real;



Constructors


constructor Create;


Functions


function bAppearanceChanged: Boolean;

Check if the position has changed.


function bTransformChanged: Boolean;

Method to determine if the matrix has changed.

The matrix has now been constructed at least once.


function bTranslateChanged: Boolean;

Check if the orientation of scaling has changed.


procedure ConstructMatrix;

Method for refreshing the matrix with current values.


procedure RecordMatrixState;

Check if the position, orientation, or scaling has changed.


procedure Reset;

Methods for operating upon the matrix.

Initially, the matrix has not been initialized.


procedure SetTranslation(iX, iY: Real);

Reset master matrix to an identity state.


procedure TransformVertex(fInputX, fInputY: Real; var fOutputX, fOutputY: Real);

Method for transforming a single vertex through the matrix.


procedure TranslateVertex(fInputX, fInputY: Real; var fOutputX, fOutputY: Real);

Method for translating a local vertex to a new scaling system.


function fGetTranslationX: Real;

Initialize the scaling matrix.


function fGetTranslationY: Real;


procedure SetOrientation(fRadians: Real);

Methods for getting/setting property values.

Record the new translation values.


procedure SetScale(fScale: Real);

Initialize the rotation matrix.


procedure SetTranslationX(iX: Real);

Record the new translation values.


procedure SetTranslationY(iY: Real);

Record the new translation values.


Properties


property fOrientation : Real

Exposed properties.


property fScale : Real


property fTranslationX : Real


property fTranslationY : Real


Events


Variables


m_afMasterMatrix : array[0..2, 0..2] of Real;

Master tranformation matrix.


m_afRotationMatrix : array[0..2, 0..2] of Real;


m_afScalingMatrix : array[0..2, 0..2] of Real;

Scaling and rotation matrices.


m_bMatrixInitialized : Boolean;

TRUE when the matrix has been initialized.


m_fLastOrientation : Real;


m_fLastScale : Real;


m_fLastTranslationX : Real;

Previous transformation values.


m_fLastTranslationY : Real;


m_fOrientation : Real;


m_fScale : Real;


m_fTranslationX : Real;

Current Transformation Values.


m_fTranslationY : Real;