Drag[en]gine Game Engine  1.21
decColorMatrix3 Class Reference

4x3 Component Matrix. Provides matrix calculation on a 3x3 matrix in row major order. This kind of matrix is useful for transforming 3 component color values. More...

#include <decColorMatrix3.h>

Public Member Functions

Constructors and Destructors
 decColorMatrix3 ()
 Create new color matrix initialized to identity. More...
 
 decColorMatrix3 (const decColorMatrix3 &m)
 Create copy of a color matrix. More...
 
Management
void SetIdentity ()
 Sets identity color matrix. More...
 
void SetTranslation (float red, float green, float blue)
 Sets color translation matrix. More...
 
void SetTranslation (const decColor &color)
 Sets color translation matrix. More...
 
void SetScaling (float sred, float sgreen, float sblue)
 Sets color scaling matrix. More...
 
void SetScaling (const decColor &color)
 Sets color scaling matrix. More...
 
void SetFrom (const decColor &red, const decColor &green, const decColor &blue, const decColor &translation)
 Set color matrix with the given colors as transformation base. More...
 
float Determinant () const
 Calculates the determinant of the color matrix. More...
 
decColorMatrix3 Invert () const
 Inverse of this color matrix if the inverse is possible. More...
 
decColor GetRedBase () const
 Red color base. More...
 
decColor GetGreenBase () const
 Green color base. More...
 
decColor GetBlueBase () const
 Blue color base. More...
 
decColor GetTranslationBase () const
 Translation color base. More...
 
void SetRedBase (const decColor &color)
 Set red color base. More...
 
void SetGreenBase (const decColor &color)
 Set green color base. More...
 
void SetBlueBase (const decColor &color)
 Set blue color base. More...
 
void SetTranslationBase (const decColor &color)
 Set translation color base. More...
 
decColor Transform (const decColor &color) const
 Transforms color by this matrix. More...
 
bool IsEqualTo (const decColorMatrix3 &matrix, float threshold=VECTOR_THRESHOLD) const
 Matrix is cell wise equal to another one in respect to a threshold. More...
 
Operators
decColorMatrix3operator= (const decColorMatrix3 &matrix)
 Set cells of this matrix to the values of another one. More...
 
decColorMatrix3operator+= (const decColorMatrix3 &matrix)
 Adds the cells of another matrix to this one. More...
 
decColorMatrix3operator-= (const decColorMatrix3 &matrix)
 Subtracts the cells of another matrix from this vector. More...
 
decColorMatrix3operator*= (float scalar)
 Multiplies the cells of this matrix with a value k. More...
 
decColorMatrix3operator/= (float scalar)
 Divide cells of this matrix by a value k. More...
 
decColorMatrix3operator*= (const decColorMatrix3 &matrix)
 Multiply matrix with another one. More...
 
decColorMatrix3 operator+ (const decColorMatrix3 &matrix) const
 Retrieves a new matrix with the sum of this matrix with another one. More...
 
decColorMatrix3 operator- (const decColorMatrix3 &matrix) const
 Retrieves a new matrix with the difference of this matrix to another one. More...
 
decColorMatrix3 operator* (float scalar) const
 Retrieves a new matrix with this matrix scaled by k. More...
 
decColorMatrix3 operator/ (float scalar) const
 Matrix with this matrix divided by k. More...
 
decColorMatrix3 operator* (const decColorMatrix3 &matrix) const
 Matrix with this matrix multiplied with another one. More...
 
decColor operator* (const decColor &color) const
 Transforms color by this matrix. More...
 

Static Public Member Functions

Matrix Creation
static decColorMatrix3 CreateIdentity ()
 Create new identity color matrix. More...
 
static decColorMatrix3 CreateTranslation (float red, float green, float blue)
 Create new color translation matrix. More...
 
static decColorMatrix3 CreateTranslation (const decColor &color)
 Create new color translation matrix. More...
 
static decColorMatrix3 CreateScaling (float sred, float sgreen, float sblue)
 Create new color scaling matrix. More...
 
static decColorMatrix3 CreateScaling (const decColor &color)
 Create new color scaling matrix. More...
 
static decColorMatrix3 CreateFrom (const decColor &red, const decColor &green, const decColor &blue, const decColor &translation)
 Create color matrix with the given colors as transformation base. The red color fills the values in the first column, the green of the second, the blue of the third, the alpha of the fourth and the translation the fifth. More...
 

Public Attributes

Cells

The first number indicates the row the second the column.

float a11
 
float a12
 
float a13
 
float a14
 
float a21
 
float a22
 
float a23
 
float a24
 
float a31
 
float a32
 
float a33
 
float a34
 

Detailed Description

4x3 Component Matrix. Provides matrix calculation on a 3x3 matrix in row major order. This kind of matrix is useful for transforming 3 component color values.

Constructor & Destructor Documentation

◆ decColorMatrix3() [1/2]

decColorMatrix3::decColorMatrix3 ( )

Create new color matrix initialized to identity.

◆ decColorMatrix3() [2/2]

decColorMatrix3::decColorMatrix3 ( const decColorMatrix3 m)

Create copy of a color matrix.

Member Function Documentation

◆ CreateFrom()

static decColorMatrix3 decColorMatrix3::CreateFrom ( const decColor red,
const decColor green,
const decColor blue,
const decColor translation 
)
static

Create color matrix with the given colors as transformation base. The red color fills the values in the first column, the green of the second, the blue of the third, the alpha of the fourth and the translation the fifth.

◆ CreateIdentity()

static decColorMatrix3 decColorMatrix3::CreateIdentity ( )
static

Create new identity color matrix.

◆ CreateScaling() [1/2]

static decColorMatrix3 decColorMatrix3::CreateScaling ( const decColor color)
static

Create new color scaling matrix.

◆ CreateScaling() [2/2]

static decColorMatrix3 decColorMatrix3::CreateScaling ( float  sred,
float  sgreen,
float  sblue 
)
static

Create new color scaling matrix.

◆ CreateTranslation() [1/2]

static decColorMatrix3 decColorMatrix3::CreateTranslation ( const decColor color)
static

Create new color translation matrix.

◆ CreateTranslation() [2/2]

static decColorMatrix3 decColorMatrix3::CreateTranslation ( float  red,
float  green,
float  blue 
)
static

Create new color translation matrix.

◆ Determinant()

float decColorMatrix3::Determinant ( ) const

Calculates the determinant of the color matrix.

Mathematically this only works on a 5x5 matrix. Hence the color matrix is first expanded with an identity line at the bottom to become a 5x5 matrix to calculate the determinant from.

◆ GetBlueBase()

decColor decColorMatrix3::GetBlueBase ( ) const

Blue color base.

◆ GetGreenBase()

decColor decColorMatrix3::GetGreenBase ( ) const

Green color base.

◆ GetRedBase()

decColor decColorMatrix3::GetRedBase ( ) const

Red color base.

◆ GetTranslationBase()

decColor decColorMatrix3::GetTranslationBase ( ) const

Translation color base.

◆ Invert()

decColorMatrix3 decColorMatrix3::Invert ( ) const

Inverse of this color matrix if the inverse is possible.

Mathematically this only works for a 4x4 matrix. Hence we expand the color matrix with an identity line to become a 4x4 matrix. Thereof the inverse is calculated and only the 4x3 part is returned.

◆ IsEqualTo()

bool decColorMatrix3::IsEqualTo ( const decColorMatrix3 matrix,
float  threshold = VECTOR_THRESHOLD 
) const

Matrix is cell wise equal to another one in respect to a threshold.

◆ operator*() [1/3]

decColor decColorMatrix3::operator* ( const decColor color) const

Transforms color by this matrix.

◆ operator*() [2/3]

decColorMatrix3 decColorMatrix3::operator* ( const decColorMatrix3 matrix) const

Matrix with this matrix multiplied with another one.

Mathematically this would yield a 5x5 matrix but as a color matrix has no use for the last line only the 5x4 part is returned.

◆ operator*() [3/3]

decColorMatrix3 decColorMatrix3::operator* ( float  scalar) const

Retrieves a new matrix with this matrix scaled by k.

◆ operator*=() [1/2]

decColorMatrix3& decColorMatrix3::operator*= ( const decColorMatrix3 matrix)

Multiply matrix with another one.

Mathematically this would yield a 5x5 matrix but as a color matrix has no use for the last line only the 5x4 part is returned.

◆ operator*=() [2/2]

decColorMatrix3& decColorMatrix3::operator*= ( float  scalar)

Multiplies the cells of this matrix with a value k.

◆ operator+()

decColorMatrix3 decColorMatrix3::operator+ ( const decColorMatrix3 matrix) const

Retrieves a new matrix with the sum of this matrix with another one.

◆ operator+=()

decColorMatrix3& decColorMatrix3::operator+= ( const decColorMatrix3 matrix)

Adds the cells of another matrix to this one.

◆ operator-()

decColorMatrix3 decColorMatrix3::operator- ( const decColorMatrix3 matrix) const

Retrieves a new matrix with the difference of this matrix to another one.

◆ operator-=()

decColorMatrix3& decColorMatrix3::operator-= ( const decColorMatrix3 matrix)

Subtracts the cells of another matrix from this vector.

◆ operator/()

decColorMatrix3 decColorMatrix3::operator/ ( float  scalar) const

Matrix with this matrix divided by k.

If k is 0 an exception is thrown.

◆ operator/=()

decColorMatrix3& decColorMatrix3::operator/= ( float  scalar)

Divide cells of this matrix by a value k.

If the value k is 0 an exception is thrown.

◆ operator=()

decColorMatrix3& decColorMatrix3::operator= ( const decColorMatrix3 matrix)

Set cells of this matrix to the values of another one.

◆ SetBlueBase()

void decColorMatrix3::SetBlueBase ( const decColor color)

Set blue color base.

◆ SetFrom()

void decColorMatrix3::SetFrom ( const decColor red,
const decColor green,
const decColor blue,
const decColor translation 
)

Set color matrix with the given colors as transformation base.

The red color fills the values in the first column, the green of the second, the blue of the third, the alpha of the fourth and the translation the fifth.

◆ SetGreenBase()

void decColorMatrix3::SetGreenBase ( const decColor color)

Set green color base.

◆ SetIdentity()

void decColorMatrix3::SetIdentity ( )

Sets identity color matrix.

◆ SetRedBase()

void decColorMatrix3::SetRedBase ( const decColor color)

Set red color base.

◆ SetScaling() [1/2]

void decColorMatrix3::SetScaling ( const decColor color)

Sets color scaling matrix.

◆ SetScaling() [2/2]

void decColorMatrix3::SetScaling ( float  sred,
float  sgreen,
float  sblue 
)

Sets color scaling matrix.

◆ SetTranslation() [1/2]

void decColorMatrix3::SetTranslation ( const decColor color)

Sets color translation matrix.

◆ SetTranslation() [2/2]

void decColorMatrix3::SetTranslation ( float  red,
float  green,
float  blue 
)

Sets color translation matrix.

◆ SetTranslationBase()

void decColorMatrix3::SetTranslationBase ( const decColor color)

Set translation color base.

◆ Transform()

decColor decColorMatrix3::Transform ( const decColor color) const

Transforms color by this matrix.

Member Data Documentation

◆ a11

float decColorMatrix3::a11

◆ a12

float decColorMatrix3::a12

◆ a13

float decColorMatrix3::a13

◆ a14

float decColorMatrix3::a14

◆ a21

float decColorMatrix3::a21

◆ a22

float decColorMatrix3::a22

◆ a23

float decColorMatrix3::a23

◆ a24

float decColorMatrix3::a24

◆ a31

float decColorMatrix3::a31

◆ a32

float decColorMatrix3::a32

◆ a33

float decColorMatrix3::a33

◆ a34

float decColorMatrix3::a34

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