Record TGenericMatrix4

Unit

Declaration

type TGenericMatrix4 = record

Description

4x4 matrix of floating-point values.

See also
TGenericMatrix3
3x3 matrix of floating-point values.

Source: src/base/castlevectors_generic_float_record.inc (line 638).

Overview

Nested Types

Public TIndex = 0..3;
Public TIndexArray = array[TIndex] of TGenericScalar;

Fields

Public var Data: array [TIndex] of TIndexArray;

Methods

Public class operator + (const A, B: TGenericMatrix4): TGenericMatrix4; inline;
Public class operator - (const A, B: TGenericMatrix4): TGenericMatrix4; inline;
Public class operator - (const M: TGenericMatrix4): TGenericMatrix4; inline;
Public class operator * (const V: TGenericMatrix4; const Scalar: TGenericScalar): TGenericMatrix4; inline;
Public class operator * (const Scalar: TGenericScalar; const V: TGenericMatrix4): TGenericMatrix4; inline;
Public class operator * (const M: TGenericMatrix4; const V: TGenericVector4): TGenericVector4; inline;
Public class operator * (const M1, M2: TGenericMatrix4): TGenericMatrix4; inline;
Public function TransposeMultiply(const V: TGenericVector4): TGenericVector4; inline;
Public function ToString(const LineIndent: string = ''): string;
Public function ToRawString(const LineIndent: String = ''; const FloatFormat: String = '%g'): String;
Public function Determinant: TGenericScalar;
Public function Inverse(ADeterminant: TGenericScalar): TGenericMatrix4;
Public function TryInverse(out MInverse: TGenericMatrix4): boolean;
Public function Transpose: TGenericMatrix4;
Public function MultPoint(const Pt: TGenericVector3): TGenericVector3; overload;
Public function MultPoint(const Pt: TGenericVector2): TGenericVector2; overload;
Public function MultDirection(const Dir: TGenericVector3): TGenericVector3; overload;
Public function MultDirection(const Dir: TGenericVector2): TGenericVector2; overload;
Public class function Equals(const M1, M2: TGenericMatrix4): boolean; overload; static;
Public class function Equals(const M1, M2: TGenericMatrix4; const Epsilon: TGenericScalar): boolean; overload; static;
Public class function PerfectlyEquals(const M1, M2: TGenericMatrix4): boolean; static;
Public class function Lerp(const A: TGenericScalar; const M1, M2: TGenericMatrix4): TGenericMatrix4; static;
Public class function Zero: TGenericMatrix4; static;
Public class function Identity: TGenericMatrix4; static;

Properties

Public property Items [const AColumn,ARow: TIndex]: TGenericScalar read GetItems write SetItems;
Public property Rows [const ARow: TIndex]: TGenericVector4 read GetRows write SetRows;
Public property Columns [const AColumn: TIndex]: TGenericVector4 read GetColumns write SetColumns;

Description

Nested Types

Public TIndex = 0..3;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 638).

Public TIndexArray = array[TIndex] of TGenericScalar;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 638).

Fields

Public var Data: array [TIndex] of TIndexArray;

Data: array [TIndex, TIndex] of TGenericScalar;

Source: src/base/castlevectors_generic_float_record.inc (line 670).

Methods

Public class operator + (const A, B: TGenericMatrix4): TGenericMatrix4; inline;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 672).

Public class operator - (const A, B: TGenericMatrix4): TGenericMatrix4; inline;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 673).

Public class operator - (const M: TGenericMatrix4): TGenericMatrix4; inline;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 674).

Public class operator * (const V: TGenericMatrix4; const Scalar: TGenericScalar): TGenericMatrix4; inline;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 675).

Public class operator * (const Scalar: TGenericScalar; const V: TGenericMatrix4): TGenericMatrix4; inline;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 676).

Public class operator * (const M: TGenericMatrix4; const V: TGenericVector4): TGenericVector4; inline;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 677).

Public class operator * (const M1, M2: TGenericMatrix4): TGenericMatrix4; inline;

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.

Source: src/base/castlevectors_generic_float_record.inc (line 682).

Public function TransposeMultiply(const V: TGenericVector4): TGenericVector4; inline;

Calculates "M.Transpose * V" in a faster way (without spending *any* time on calculating transposition).

Source: src/base/castlevectors_generic_float_record.inc (line 686).

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

Convert to multi-line string.

The output follows the natural mathematical look of the matrix, so the first line shows the firt row, and so on. This matches X3D matrix notation and contrasts with VRML 1.0 notation.

Source: src/base/castlevectors_generic_float_record.inc (line 693).

Public function ToRawString(const LineIndent: String = ''; const FloatFormat: String = '%g'): String;

Convert to multi-line 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.

You can pass, as parameter, the format to use. By default it is '%g', "general number format" with maximum precision documented on https://www.freepascal.org/docs-html/rtl/sysutils/format.html .

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

Source: src/base/castlevectors_generic_float_record.inc (line 706).

Public function Determinant: TGenericScalar;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 711).

Public function Inverse(ADeterminant: TGenericScalar): TGenericMatrix4;

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.

Source: src/base/castlevectors_generic_float_record.inc (line 718).

Public function TryInverse(out MInverse: TGenericMatrix4): boolean;

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

Source: src/base/castlevectors_generic_float_record.inc (line 721).

Public function Transpose: TGenericMatrix4;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 723).

Public function MultPoint(const Pt: TGenericVector3): TGenericVector3; overload;

Transform a 3D or 2D point with 4x4 matrix.

This works by temporarily converting point to 4-component vector (4th component is 1). After multiplying matrix * vector we divide by 4th component. So this works Ok for all matrices, even with last row different than identity (0, 0, 0, 1). E.g. this works for projection matrices too.

Exceptions raised
ETransformedResultInvalid
This is raised when matrix will transform point to a direction (vector with 4th component equal zero). In this case we just cannot interpret the result as a point.

Source: src/base/castlevectors_generic_float_record.inc (line 738).

Public function MultPoint(const Pt: TGenericVector2): TGenericVector2; overload;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 739).

Public function MultDirection(const Dir: TGenericVector3): TGenericVector3; overload;

Transform a 3D or 2D direction with 4x4 matrix.

This works by temporarily converting direction to 4-component vector (4th component is 0). After multiplying matrix * vector we check is the 4th component still 0 (eventually raising ETransformedResultInvalid).

Exceptions raised
ETransformedResultInvalid
This is raised when matrix will transform direction to a point (vector with 4th component nonzero). In this case we just cannot interpret the result as a direction.

Source: src/base/castlevectors_generic_float_record.inc (line 753).

Public function MultDirection(const Dir: TGenericVector2): TGenericVector2; overload;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 754).

Public class function Equals(const M1, M2: TGenericMatrix4): boolean; overload; static;

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

Source: src/base/castlevectors_generic_float_record.inc (line 758).

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

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 759).

Public class function PerfectlyEquals(const M1, M2: TGenericMatrix4): boolean; static;

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

Source: src/base/castlevectors_generic_float_record.inc (line 762).

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

Linear interpolation between two matrix values.

See also
TGenericVector3.Lerp
Linear interpolation between two vector values.

Source: src/base/castlevectors_generic_float_record.inc (line 766).

Public class function Zero: TGenericMatrix4; static;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 768).

Public class function Identity: TGenericMatrix4; static;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 769).

Properties

Public property Items [const AColumn,ARow: TIndex]: TGenericScalar read GetItems write SetItems;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 708).

Public property Rows [const ARow: TIndex]: TGenericVector4 read GetRows write SetRows;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 709).

Public property Columns [const AColumn: TIndex]: TGenericVector4 read GetColumns write SetColumns;

This item has no description.

Source: src/base/castlevectors_generic_float_record.inc (line 710).


Generated by PasDoc 0.17.0.snapshot.