decColorMatrix3 Class Reference

4x3 Component Matrix. More...

#include <decColorMatrix3.h>

List of all members.

Public Member Functions

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

Static Public Member Functions

Matrix Creation
static decColorMatrix3 CreateIdentity ()
 Creates a new identity color matrix.
static decColorMatrix3 CreateTranslation (float red, float green, float blue)
 Creates a new color translation matrix.
static decColorMatrix3 CreateTranslation (const decColor &color)
 Creates a new color translation matrix.
static decColorMatrix3 CreateScaling (float sred, float sgreen, float sblue)
 Creates a new color scaling matrix.
static decColorMatrix3 CreateScaling (const decColor &color)
 Creates a new color scaling matrix.
static decColorMatrix3 CreateFrom (const decColor &red, const decColor &green, const decColor &blue, const decColor &translation)
 Creates a color matrix with the given colors as transformation base.

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::decColorMatrix3 (  )

Creates a new color matrix initialized to identity.


Member Function Documentation

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.

static decColorMatrix3 decColorMatrix3::CreateIdentity (  ) [static]

Creates a new identity color matrix.

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

Creates a new color scaling matrix.

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

Creates a new color scaling matrix.

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

Creates a new color translation matrix.

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

Creates a new color translation matrix.

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.

decColor decColorMatrix3::GetBlueBase (  ) const [inline]

Retrieves the blue color base.

References a13, a23, and a33.

decColor decColorMatrix3::GetGreenBase (  ) const [inline]

Retrieves the green color base.

References a12, a22, and a32.

decColor decColorMatrix3::GetRedBase (  ) const [inline]

Retrieves the red color base.

References a11, a21, and a31.

decColor decColorMatrix3::GetTranslationBase (  ) const [inline]

Retrieves the translation color base.

References a14, a24, and a34.

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.

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

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

decColorMatrix3 decColorMatrix3::operator* ( float  scalar ) const

Retrieves a new matrix with this matrix scaled by k.

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

Transforms color by this matrix.

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.

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

Multiplies the cells of this matrix with a value k.

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.

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

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

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

Adds the cells of another matrix to this one.

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

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

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

Subtracts the cells of another matrix from this vector.

decColorMatrix3 decColorMatrix3::operator/ ( float  scalar ) const

Retrieves a new matrix with this matrix divided by k.

If k is 0 an exception is thrown.

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.

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

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

void decColorMatrix3::SetBlueBase ( const decColor color ) [inline]

Sets the blue color base.

References a13, a23, a33, decColor::b, decColor::g, and decColor::r.

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.

void decColorMatrix3::SetGreenBase ( const decColor color ) [inline]

Sets the green color base.

References a12, a22, a32, decColor::b, decColor::g, and decColor::r.

void decColorMatrix3::SetIdentity (  )

Sets identity color matrix.

void decColorMatrix3::SetRedBase ( const decColor color ) [inline]

Sets the red color base.

References a11, a21, a31, decColor::b, decColor::g, and decColor::r.

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

Sets color scaling matrix.

void decColorMatrix3::SetScaling ( const decColor color )

Sets color scaling matrix.

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

Sets color translation matrix.

void decColorMatrix3::SetTranslation ( const decColor color )

Sets color translation matrix.

void decColorMatrix3::SetTranslationBase ( const decColor color ) [inline]

Sets the translation color base.

References a14, a24, a34, decColor::b, decColor::g, and decColor::r.

decColor decColorMatrix3::Transform ( const decColor color ) const

Transforms color by this matrix.


Member Data Documentation

Referenced by GetRedBase(), and SetRedBase().

Referenced by GetGreenBase(), and SetGreenBase().

Referenced by GetBlueBase(), and SetBlueBase().

Referenced by GetRedBase(), and SetRedBase().

Referenced by GetGreenBase(), and SetGreenBase().

Referenced by GetBlueBase(), and SetBlueBase().

Referenced by GetRedBase(), and SetRedBase().

Referenced by GetGreenBase(), and SetGreenBase().

Referenced by GetBlueBase(), and SetBlueBase().


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