Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.DMatrix4 Class Reference

Immutable 4x4-component row major double precision matrix. More...

Inheritance diagram for Dragengine.Scenery.DMatrix4:

Public Member Functions

Management
float getAt (int row, int col)
 Value at row and colon. More...
 
float get11 ()
 Value at (1,1). More...
 
float get12 ()
 Value at (1,2). More...
 
float get13 ()
 Value at (1,3). More...
 
float get14 ()
 Value at (1,4). More...
 
float get21 ()
 Value at (2,1). More...
 
float get22 ()
 Value at (2,2). More...
 
float get23 ()
 Value at (2,3). More...
 
float get24 ()
 Value at (2,4). More...
 
float get31 ()
 Value at (3,1). More...
 
float get32 ()
 Value at (3,2). More...
 
float get33 ()
 Value at (3,3). More...
 
float get34 ()
 Value at (3,4). More...
 
float get41 ()
 Value at (4,1). More...
 
float get42 ()
 Value at (4,2). More...
 
float get43 ()
 Value at (4,3). More...
 
float get44 ()
 Value at (4,4). More...
 
DVector getViewVector ()
 Vector composed of the third column. More...
 
DVector getUpVector ()
 Vector composed of the second column. More...
 
DVector getRightVector ()
 Vector composed of the first column. More...
 
DVector getPosition ()
 Vector composed of the fourth column. More...
 
DVector transformNormal (DVector normal)
 Transform normal by matrix. More...
 
DVector getEulerAngles ()
 Euler angles. More...
 
DMatrix4 getInverse ()
 Inverse. More...
 
DMatrix4 normalize ()
 Normalize matrix. More...
 
Quaternion toQuaternion ()
 Quaternion from upper 3x3 matrix. More...
 
DMatrix toDMatrix ()
 the double precision matrix. More...
 
Matrix4 toMatrix4 ()
 the single precision matrix. More...
 
Matrix toMatrix ()
 the single precision matrix. More...
 
bool equals (Object other)
 Matrix is equal to another object. More...
 
int hashCode ()
 Hash code for use as dictionary keys. More...
 
String toString ()
 String representation of matrix. More...
 
String toString (int precision)
 String representation of matrix with precision. More...
 
Operators
DMatrix4 operator+ (DMatrix4 matrix)
 Sum of matrix with another DMatrix4. More...
 
DMatrix4 operator- (DMatrix4 matrix)
 Difference of matrix and another DMatrix4. More...
 
DMatrix4 operator* (float k)
 Matrix multiplied by a factor. More...
 
DMatrix4 operator/ (float k)
 Matrix divided by a factor. More...
 
DMatrix4 operator* (DMatrix4 matrix)
 Matrix multiplied by another DMatrix4. More...
 
DVector operator* (DVector vector)
 Vector transformed by matrix. More...
 

Constructors

DMatrix4 new ()
 Create identity matrix. More...
 
DMatrix4 new (float a11, float a12, float a13, float a14, float a21, float a22, float a23, float a24, float a31, float a32, float a33, float a34, float a41, float a42, float a43, float a44)
 Create matrix from values. More...
 
static DMatrix4 newTranslation (DVector translation)
 Create translation matrix. More...
 
static DMatrix4 newTranslation (float tx, float ty, float tz)
 Create translation matrix. More...
 
static DMatrix4 newScaling (DVector scaling)
 Create scaling matrix. More...
 
static DMatrix4 newScaling (float sx, float sy, float sz)
 Create scaling matrix. More...
 
static DMatrix4 newRotationX (float rotation)
 Create rotation around the x axis matrix. More...
 
static DMatrix4 newRotationY (float rotation)
 Create rotation around the y axis matrix. More...
 
static DMatrix4 newRotationZ (float rotation)
 Create rotation around the z axis matrix. More...
 
static DMatrix4 newRotation (DVector rotation)
 Create rotation matrix. More...
 
static DMatrix4 newRotation (float rx, float ry, float rz)
 Create rotation matrix. More...
 
static DMatrix4 newSRT (DVector scaling, DVector rotation, DVector translation)
 Create scaling-rotation-translation matrix composing of a scaling followed by a rotation and a translation. More...
 
static DMatrix4 newRT (DVector rotation, DVector translation)
 Create rotation-translation matrix composing of a rotation followed by a translation. More...
 
static DMatrix4 newSVUT (DVector scaling, DVector view, DVector up, DVector translation)
 Create scale-view-up-translation matrix composing of a rotation followed by a world matrix. More...
 
static DMatrix4 newVU (DVector view, DVector up)
 Create view-up matrix. More...
 
static DMatrix4 newCamera (DVector position, DVector view, DVector up)
 Create camera matrix. More...
 
static DMatrix4 newWorld (DVector position, DVector view, DVector up)
 Create world matrix. More...
 
static DMatrix4 newWorld (DVector position, Quaternion orientation)
 Create world matrix. More...
 
static DMatrix4 newProjection (int width, int height, float fov, float fovRatio, float znear, float zfar)
 Create projection matrix. More...
 
static DMatrix4 newOrtho (int left, int right, int top, int bottom, int znear, int zfar)
 Create an orthogonal matrix. More...
 
static DMatrix4 newFromQuaternion (Quaternion quaternion)
 Create rotation matrix from the given quaternion. More...
 

File Handling

void writeToFile (FileWriter writer)
 Write matrix to a file writer. More...
 
static DMatrix4 readFromFile (FileReader reader)
 Read matrix from a file reader. More...
 

Detailed Description

Immutable 4x4-component row major double precision matrix.

This is a native class. It can not be subclassed.

Member Function Documentation

◆ equals()

bool Dragengine.Scenery.DMatrix4.equals ( Object  other)

Matrix is equal to another object.

Implements Object.equals(Object).

Returns
true if other is of type DMatrix4 and components are equal.

◆ get11()

float Dragengine.Scenery.DMatrix4.get11 ( )

Value at (1,1).

◆ get12()

float Dragengine.Scenery.DMatrix4.get12 ( )

Value at (1,2).

◆ get13()

float Dragengine.Scenery.DMatrix4.get13 ( )

Value at (1,3).

◆ get14()

float Dragengine.Scenery.DMatrix4.get14 ( )

Value at (1,4).

◆ get21()

float Dragengine.Scenery.DMatrix4.get21 ( )

Value at (2,1).

◆ get22()

float Dragengine.Scenery.DMatrix4.get22 ( )

Value at (2,2).

◆ get23()

float Dragengine.Scenery.DMatrix4.get23 ( )

Value at (2,3).

◆ get24()

float Dragengine.Scenery.DMatrix4.get24 ( )

Value at (2,4).

◆ get31()

float Dragengine.Scenery.DMatrix4.get31 ( )

Value at (3,1).

◆ get32()

float Dragengine.Scenery.DMatrix4.get32 ( )

Value at (3,2).

◆ get33()

float Dragengine.Scenery.DMatrix4.get33 ( )

Value at (3,3).

◆ get34()

float Dragengine.Scenery.DMatrix4.get34 ( )

Value at (3,4).

◆ get41()

float Dragengine.Scenery.DMatrix4.get41 ( )

Value at (4,1).

◆ get42()

float Dragengine.Scenery.DMatrix4.get42 ( )

Value at (4,2).

◆ get43()

float Dragengine.Scenery.DMatrix4.get43 ( )

Value at (4,3).

◆ get44()

float Dragengine.Scenery.DMatrix4.get44 ( )

Value at (4,4).

◆ getAt()

float Dragengine.Scenery.DMatrix4.getAt ( int  row,
int  col 
)

Value at row and colon.

Exceptions
EInvalidParamrow is less than 0 or larger than 3.
EInvalidParamcol is less than 0 or larger than 3.

◆ getEulerAngles()

DVector Dragengine.Scenery.DMatrix4.getEulerAngles ( )

Euler angles.

◆ getInverse()

DMatrix4 Dragengine.Scenery.DMatrix4.getInverse ( )

Inverse.

◆ getPosition()

DVector Dragengine.Scenery.DMatrix4.getPosition ( )

Vector composed of the fourth column.

◆ getRightVector()

DVector Dragengine.Scenery.DMatrix4.getRightVector ( )

Vector composed of the first column.

◆ getUpVector()

DVector Dragengine.Scenery.DMatrix4.getUpVector ( )

Vector composed of the second column.

◆ getViewVector()

DVector Dragengine.Scenery.DMatrix4.getViewVector ( )

Vector composed of the third column.

◆ hashCode()

int Dragengine.Scenery.DMatrix4.hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

◆ new() [1/2]

DMatrix4 Dragengine.Scenery.DMatrix4.new ( )

Create identity matrix.

◆ new() [2/2]

DMatrix4 Dragengine.Scenery.DMatrix4.new ( float  a11,
float  a12,
float  a13,
float  a14,
float  a21,
float  a22,
float  a23,
float  a24,
float  a31,
float  a32,
float  a33,
float  a34,
float  a41,
float  a42,
float  a43,
float  a44 
)

Create matrix from values.

◆ newCamera()

static DMatrix4 Dragengine.Scenery.DMatrix4.newCamera ( DVector  position,
DVector  view,
DVector  up 
)
static

Create camera matrix.

◆ newFromQuaternion()

static DMatrix4 Dragengine.Scenery.DMatrix4.newFromQuaternion ( Quaternion  quaternion)
static

Create rotation matrix from the given quaternion.

◆ newOrtho()

static DMatrix4 Dragengine.Scenery.DMatrix4.newOrtho ( int  left,
int  right,
int  top,
int  bottom,
int  znear,
int  zfar 
)
static

Create an orthogonal matrix.

◆ newProjection()

static DMatrix4 Dragengine.Scenery.DMatrix4.newProjection ( int  width,
int  height,
float  fov,
float  fovRatio,
float  znear,
float  zfar 
)
static

Create projection matrix.

◆ newRotation() [1/2]

static DMatrix4 Dragengine.Scenery.DMatrix4.newRotation ( DVector  rotation)
static

Create rotation matrix.

◆ newRotation() [2/2]

static DMatrix4 Dragengine.Scenery.DMatrix4.newRotation ( float  rx,
float  ry,
float  rz 
)
static

Create rotation matrix.

◆ newRotationX()

static DMatrix4 Dragengine.Scenery.DMatrix4.newRotationX ( float  rotation)
static

Create rotation around the x axis matrix.

◆ newRotationY()

static DMatrix4 Dragengine.Scenery.DMatrix4.newRotationY ( float  rotation)
static

Create rotation around the y axis matrix.

◆ newRotationZ()

static DMatrix4 Dragengine.Scenery.DMatrix4.newRotationZ ( float  rotation)
static

Create rotation around the z axis matrix.

◆ newRT()

static DMatrix4 Dragengine.Scenery.DMatrix4.newRT ( DVector  rotation,
DVector  translation 
)
static

Create rotation-translation matrix composing of a rotation followed by a translation.

◆ newScaling() [1/2]

static DMatrix4 Dragengine.Scenery.DMatrix4.newScaling ( DVector  scaling)
static

Create scaling matrix.

◆ newScaling() [2/2]

static DMatrix4 Dragengine.Scenery.DMatrix4.newScaling ( float  sx,
float  sy,
float  sz 
)
static

Create scaling matrix.

◆ newSRT()

static DMatrix4 Dragengine.Scenery.DMatrix4.newSRT ( DVector  scaling,
DVector  rotation,
DVector  translation 
)
static

Create scaling-rotation-translation matrix composing of a scaling followed by a rotation and a translation.

◆ newSVUT()

static DMatrix4 Dragengine.Scenery.DMatrix4.newSVUT ( DVector  scaling,
DVector  view,
DVector  up,
DVector  translation 
)
static

Create scale-view-up-translation matrix composing of a rotation followed by a world matrix.

◆ newTranslation() [1/2]

static DMatrix4 Dragengine.Scenery.DMatrix4.newTranslation ( DVector  translation)
static

Create translation matrix.

◆ newTranslation() [2/2]

static DMatrix4 Dragengine.Scenery.DMatrix4.newTranslation ( float  tx,
float  ty,
float  tz 
)
static

Create translation matrix.

◆ newVU()

static DMatrix4 Dragengine.Scenery.DMatrix4.newVU ( DVector  view,
DVector  up 
)
static

Create view-up matrix.

◆ newWorld() [1/2]

static DMatrix4 Dragengine.Scenery.DMatrix4.newWorld ( DVector  position,
DVector  view,
DVector  up 
)
static

Create world matrix.

◆ newWorld() [2/2]

static DMatrix4 Dragengine.Scenery.DMatrix4.newWorld ( DVector  position,
Quaternion  orientation 
)
static

Create world matrix.

◆ normalize()

DMatrix4 Dragengine.Scenery.DMatrix4.normalize ( )

Normalize matrix.

Returns matrix with scaling removed. Only normalized matrices are safe to be used with the getEulerAngles() and toQuaternion() calls since scaling interferes with the calculation.

This calls the same as this code

DMatrix.newWorld(m.getPosition(), getViewVector(), m.getUpVector())
DVector getViewVector()
Vector composed of the third column.

but is safe against 0-scaling. In such a case a 0-rotation matrix is created.

◆ operator*() [1/3]

DMatrix4 Dragengine.Scenery.DMatrix4.operator* ( DMatrix4  matrix)

Matrix multiplied by another DMatrix4.

◆ operator*() [2/3]

DVector Dragengine.Scenery.DMatrix4.operator* ( DVector  vector)

Vector transformed by matrix.

◆ operator*() [3/3]

DMatrix4 Dragengine.Scenery.DMatrix4.operator* ( float  k)

Matrix multiplied by a factor.

◆ operator+()

DMatrix4 Dragengine.Scenery.DMatrix4.operator+ ( DMatrix4  matrix)

Sum of matrix with another DMatrix4.

◆ operator-()

DMatrix4 Dragengine.Scenery.DMatrix4.operator- ( DMatrix4  matrix)

Difference of matrix and another DMatrix4.

◆ operator/()

DMatrix4 Dragengine.Scenery.DMatrix4.operator/ ( float  k)

Matrix divided by a factor.

Exceptions
EDivisionByZeroscalar is 0.

◆ readFromFile()

static DMatrix4 Dragengine.Scenery.DMatrix4.readFromFile ( FileReader  reader)
static

Read matrix from a file reader.

◆ toDMatrix()

DMatrix Dragengine.Scenery.DMatrix4.toDMatrix ( )

the double precision matrix.

◆ toMatrix()

Matrix Dragengine.Scenery.DMatrix4.toMatrix ( )

the single precision matrix.

◆ toMatrix4()

Matrix4 Dragengine.Scenery.DMatrix4.toMatrix4 ( )

the single precision matrix.

◆ toQuaternion()

Quaternion Dragengine.Scenery.DMatrix4.toQuaternion ( )

Quaternion from upper 3x3 matrix.

◆ toString() [1/2]

String Dragengine.Scenery.DMatrix4.toString ( )

String representation of matrix.

Implements Object.toString()

◆ toString() [2/2]

String Dragengine.Scenery.DMatrix4.toString ( int  precision)

String representation of matrix with precision.

Same as toString() except the count of digits of each component is precision.

Parameters
precisionPrecision in digits in the range from 0 to 17 inclusive.
Exceptions
EInvalidParamprecision is less than 0 or larger than 17.

◆ transformNormal()

DVector Dragengine.Scenery.DMatrix4.transformNormal ( DVector  normal)

Transform normal by matrix.

◆ writeToFile()

void Dragengine.Scenery.DMatrix4.writeToFile ( FileWriter  writer)

Write matrix to a file writer.


The documentation for this class was generated from the following file: