Drag[en]gine Game Engine  1.0
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 ()
 
 decColorMatrix3 (const decColorMatrix3 &m)
 
Management
void SetIdentity ()
 
void SetTranslation (float red, float green, float blue)
 
void SetTranslation (const decColor &color)
 
void SetScaling (float sred, float sgreen, float sblue)
 
void SetScaling (const decColor &color)
 
void SetFrom (const decColor &red, const decColor &green, const decColor &blue, const decColor &translation)
 
float Determinant () const
 
decColorMatrix3 Invert () const
 
decColor GetRedBase () const
 
decColor GetGreenBase () const
 
decColor GetBlueBase () const
 
decColor GetTranslationBase () const
 
void SetRedBase (const decColor &color)
 
void SetGreenBase (const decColor &color)
 
void SetBlueBase (const decColor &color)
 
void SetTranslationBase (const decColor &color)
 
decColor Transform (const decColor &color) const
 
bool IsEqualTo (const decColorMatrix3 &matrix, float threshold=VECTOR_THRESHOLD) const
 
Operators
decColorMatrix3operator= (const decColorMatrix3 &matrix)
 
decColorMatrix3operator+= (const decColorMatrix3 &matrix)
 
decColorMatrix3operator-= (const decColorMatrix3 &matrix)
 
decColorMatrix3operator*= (float scalar)
 
decColorMatrix3operator/= (float scalar)
 
decColorMatrix3operator*= (const decColorMatrix3 &matrix)
 
decColorMatrix3 operator+ (const decColorMatrix3 &matrix) const
 
decColorMatrix3 operator- (const decColorMatrix3 &matrix) const
 
decColorMatrix3 operator* (float scalar) const
 
decColorMatrix3 operator/ (float scalar) const
 
decColorMatrix3 operator* (const decColorMatrix3 &matrix) const
 
decColor operator* (const decColor &color) const
 

Static Public Member Functions

Matrix Creation
static decColorMatrix3 CreateIdentity ()
 
static decColorMatrix3 CreateTranslation (float red, float green, float blue)
 
static decColorMatrix3 CreateTranslation (const decColor &color)
 
static decColorMatrix3 CreateScaling (float sred, float sgreen, float sblue)
 
static decColorMatrix3 CreateScaling (const decColor &color)
 
static decColorMatrix3 CreateFrom (const decColor &red, const decColor &green, const decColor &blue, const decColor &translation)
 

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.

Author
Pl├╝ss Roland
Version
1.0
Date
2010

Constructor & Destructor Documentation

◆ decColorMatrix3() [1/2]

decColorMatrix3::decColorMatrix3 ( )

Creates a new color matrix initialized to identity.

◆ decColorMatrix3() [2/2]

decColorMatrix3::decColorMatrix3 ( const decColorMatrix3 m)

Creates a 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

Creates a 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

Creates a new identity color matrix.

◆ CreateScaling() [1/2]

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

Creates a new color scaling matrix.

◆ CreateScaling() [2/2]

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

Creates a new color scaling matrix.

◆ CreateTranslation() [1/2]

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

Creates a new color translation matrix.

◆ CreateTranslation() [2/2]

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

Creates a 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

Retrieves the blue color base.

◆ GetGreenBase()

decColor decColorMatrix3::GetGreenBase ( ) const

Retrieves the green color base.

◆ GetRedBase()

decColor decColorMatrix3::GetRedBase ( ) const

Retrieves the red color base.

◆ GetTranslationBase()

decColor decColorMatrix3::GetTranslationBase ( ) const

Retrieves the translation color base.

◆ Invert()

decColorMatrix3 decColorMatrix3::Invert ( ) const

Retrieves the 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

Determines if this matrix is cell wise equal to another one in respect to a threshold.

◆ operator*() [1/3]

decColorMatrix3 decColorMatrix3::operator* ( float  scalar) const

Retrieves a new matrix with this matrix scaled by k.

◆ operator*() [2/3]

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

Retrieves a new 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]

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

Transforms color by this matrix.

◆ operator*=() [1/2]

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

Multiplies the cells of this matrix with a value k.

◆ operator*=() [2/2]

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

Multiplies this 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+()

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

Retrieves a new matrix with this matrix divided by k. If k is 0 an exception is thrown.

◆ operator/=()

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

Divides the 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)

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

◆ SetBlueBase()

void decColorMatrix3::SetBlueBase ( const decColor color)

Sets the blue color base.

◆ SetFrom()

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

Sets 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)

Sets the green color base.

◆ SetIdentity()

void decColorMatrix3::SetIdentity ( )

Sets identity color matrix.

◆ SetRedBase()

void decColorMatrix3::SetRedBase ( const decColor color)

Sets the red color base.

◆ SetScaling() [1/2]

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

Sets color scaling matrix.

◆ SetScaling() [2/2]

void decColorMatrix3::SetScaling ( const decColor color)

Sets color scaling matrix.

◆ SetTranslation() [1/2]

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

Sets color translation matrix.

◆ SetTranslation() [2/2]

void decColorMatrix3::SetTranslation ( const decColor color)

Sets color translation matrix.

◆ SetTranslationBase()

void decColorMatrix3::SetTranslationBase ( const decColor color)

Sets the 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: