Record TGenericMatrix3

Unit

Declaration

type TGenericMatrix3 = record

Description

3x3 matrix of floating-point values. Column-major, just like OpenGL, which means that the first index of Data array should be treated as a column number, the 2nd index is the row number.

This is generic type (although not using "proper" Pascal generics for implementation reasons). In has two actual uses:

  1. TMatrix3, a matrix of 3 Single values (floats with single precision),

  2. TMatrix3Double, a matrix of 3 Double values (floats with double precision).

The type TGenericScalar is, accordingly, Single or Double for TMatrix3 or TMatrix3Double.

Overview

Internal Types

TIndex = 0..2;

Fields

var Data: array [TIndex, TIndex] of TGenericScalar;

Methods

class operator + (const A, B: TGenericMatrix3): TGenericMatrix3; inline;
class operator - (const A, B: TGenericMatrix3): TGenericMatrix3; inline;
class operator - (const M: TGenericMatrix3): TGenericMatrix3; inline;
class operator * (const V: TGenericMatrix3; const Scalar: TGenericScalar): TGenericMatrix3; inline;
class operator * (const Scalar: TGenericScalar; const V: TGenericMatrix3): TGenericMatrix3; inline;
class operator * (const M: TGenericMatrix3; const V: TGenericVector3): TGenericVector3; inline;
class operator * (const M1, M2: TGenericMatrix3): TGenericMatrix3;
function ToString(const LineIndent: string = ''): string;
function ToRawString(const LineIndent: string = ''): string;
function Determinant: TGenericScalar;
function Inverse(ADeterminant: TGenericScalar): TGenericMatrix3;
function TryInverse(out MInverse: TGenericMatrix3): boolean;
function Transpose: TGenericMatrix3;
class function Equals(const M1, M2: TGenericMatrix3): boolean; overload; static;
class function Equals(const M1, M2: TGenericMatrix3; const Epsilon: TGenericScalar): boolean; overload; static;
class function PerfectlyEquals(const M1, M2: TGenericMatrix3): boolean; static;
class function Lerp(const A: TGenericScalar; const M1, M2: TGenericMatrix3): TGenericMatrix3; static;
class function Zero: TGenericMatrix3; static;
class function Identity: TGenericMatrix3; static;

Properties

property Items [constAColumn,ARow:TIndex]: TGenericScalar read GetItems write SetItems;
property Rows [constARow:TIndex]: TGenericVector3 read GetRows write SetRows;
property Columns [constAColumn:TIndex]: TGenericVector3 read GetColumns write SetColumns;

Description

Internal Types

TIndex = 0..2;
 

Fields

var Data: array [TIndex, TIndex] of TGenericScalar;
 

Methods

class operator + (const A, B: TGenericMatrix3): TGenericMatrix3; inline;
 
class operator - (const A, B: TGenericMatrix3): TGenericMatrix3; inline;
 
class operator - (const M: TGenericMatrix3): TGenericMatrix3; inline;
 
class operator * (const V: TGenericMatrix3; const Scalar: TGenericScalar): TGenericMatrix3; inline;
 
class operator * (const Scalar: TGenericScalar; const V: TGenericMatrix3): TGenericMatrix3; inline;
 
class operator * (const M: TGenericMatrix3; const V: TGenericVector3): TGenericVector3; inline;
 
class operator * (const M1, M2: TGenericMatrix3): TGenericMatrix3;

Matrix * matrix makes a normal matrix algebraic multiplication (not component-wise multiplication). Note that this is different from vectors, where vector * vector makes a component-wise multiplication.

function ToString(const LineIndent: string = ''): string;
 
function ToRawString(const LineIndent: string = ''): string;

Convert to string using the most precise (not always easily readable by humans) float format. This may use the exponential (scientific) notation to represent the floating-point value, if needed.

This is suitable for storing the value in a file, with a best precision possible.

function Determinant: TGenericScalar;
 
function Inverse(ADeterminant: TGenericScalar): TGenericMatrix3;

Inverse the matrix.

This does division by ADeterminant internally, so will raise exception from this float division if the matrix is not reversible. Check Math.IsZero(ADeterminant) first to avoid this, or use TryInverse.

function TryInverse(out MInverse: TGenericMatrix3): boolean;

Inverse the matrix, or return False if the matrix is not invertible.

function Transpose: TGenericMatrix3;
 
class function Equals(const M1, M2: TGenericMatrix3): boolean; overload; static;

Compare two vectors, with epsilon to tolerate slightly different floats.

class function Equals(const M1, M2: TGenericMatrix3; const Epsilon: TGenericScalar): boolean; overload; static;
 
class function PerfectlyEquals(const M1, M2: TGenericMatrix3): boolean; static;

Compare two vectors using exact comparison (like the "=" operator to compare floats).

class function Lerp(const A: TGenericScalar; const M1, M2: TGenericMatrix3): TGenericMatrix3; static;

Linear interpolation between two matrix values.

See also
TGenericVector3.Lerp
Linear interpolation between two vector values.
class function Zero: TGenericMatrix3; static;
 
class function Identity: TGenericMatrix3; static;
 

Properties

property Items [constAColumn,ARow:TIndex]: TGenericScalar read GetItems write SetItems;
 
property Rows [constARow:TIndex]: TGenericVector3 read GetRows write SetRows;
 
property Columns [constAColumn:TIndex]: TGenericVector3 read GetColumns write SetColumns;
 

Generated by PasDoc 0.15.0.