Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzc_matrix2x2.h File Reference

Matrix2x2 structure and operations. More...

Data Structures

struct  KzcMatrix2x2
 Structure for 2x2 matrix. More...
 

Macros

#define KZC_MATRIX2X2_INDEX_AXISX_X
 Matrix index for coordinate X of X axis. More...
 
#define KZC_MATRIX2X2_INDEX_AXISX_Y
 Matrix index for coordinate Y of X axis. More...
 
#define KZC_MATRIX2X2_INDEX_AXISY_X
 Matrix index for coordinate X of Y axis. More...
 
#define KZC_MATRIX2X2_INDEX_AXISY_Y
 Matrix index for coordinate Y of Y axis. More...
 

Functions

KZ_INLINE struct KzcMatrix2x2 kzcMatrix2x2 (kzFloat a11, kzFloat a12, kzFloat a21, kzFloat a22)
 Creates a matrix with given values. More...
 
void kzcMatrix2x2Copy (const struct KzcMatrix2x2 *sourceMatrix, struct KzcMatrix2x2 *targetMatrix)
 Create a copy of matrix. More...
 
void kzcMatrix2x2SetIdentity (struct KzcMatrix2x2 *matrix)
 Sets an identity matrix. More...
 
void kzcMatrix2x2SetInvalid (struct KzcMatrix2x2 *matrix)
 Sets an invalid matrix filled with NaNs. More...
 
void kzcMatrix2x2Transpose (const struct KzcMatrix2x2 *matrix, struct KzcMatrix2x2 *out_matrix)
 Applies a transpose to a matrix. More...
 
kzBool kzcMatrix2x2Inverse (const struct KzcMatrix2x2 *matrix, struct KzcMatrix2x2 *out_matrix)
 Applies an inversion to a matrix. More...
 
void kzcMatrix2x2Rotate (struct KzcMatrix2x2 *matrix, kzFloat angleInRadians)
 Applies rotation to a matrix, rotation angle in radians. More...
 
KZ_INLINE void kzcMatrix2x2RotateInDegrees (struct KzcMatrix2x2 *matrix, kzFloat angleInDegrees)
 Applies rotation to a matrix, rotation angle in degrees. More...
 
void kzcMatrix2x2ScaleUniform (struct KzcMatrix2x2 *matrix, kzFloat scale)
 Applies an uniform scaling for a matrix. More...
 
void kzcMatrix2x2Scale (struct KzcMatrix2x2 *matrix, kzFloat scaleX, kzFloat scaleY)
 Applies a scaling for a matrix. More...
 
kzFloat kzcMatrix2x2GetScaleX (const struct KzcMatrix2x2 *matrix)
 Gets scaling factor from matrix for its X axis. More...
 
kzFloat kzcMatrix2x2GetScaleY (const struct KzcMatrix2x2 *matrix)
 Gets scaling factor from matrix for its Y axis. More...
 
void kzcMatrix2x2ScaleX (struct KzcMatrix2x2 *matrix, kzFloat scale)
 Applies a scaling for a matrix on axis X. More...
 
void kzcMatrix2x2ScaleY (struct KzcMatrix2x2 *matrix, kzFloat scale)
 Applies a scaling for a matrix on axis Y. More...
 
KZ_INLINE void kzcMatrix2x2GetAxisX (const struct KzcMatrix2x2 *matrix, struct KzcVector2 *out_axis)
 Returns the X axis vector of the matrix. More...
 
KZ_INLINE void kzcMatrix2x2GetAxisY (const struct KzcMatrix2x2 *matrix, struct KzcVector2 *out_axis)
 Returns the Y axis vector of the matrix. More...
 
KZ_INLINE void kzcMatrix2x2SetAxisXVector2 (struct KzcMatrix2x2 *matrix, const struct KzcVector2 *axis)
 Sets the X axis vector of the matrix. More...
 
KZ_INLINE void kzcMatrix2x2SetAxisYVector2 (struct KzcMatrix2x2 *matrix, const struct KzcVector2 *axis)
 Sets the Y axis vector of the matrix. More...
 
void kzcMatrix2x2Multiply (const struct KzcMatrix2x2 *matrix1, const struct KzcMatrix2x2 *matrix2, struct KzcMatrix2x2 *out_matrix)
 Multiplies two matrices. More...
 
void kzcMatrix2x2MultiplyVector2 (const struct KzcMatrix2x2 *matrix, const struct KzcVector2 *vector, struct KzcVector2 *out_vector)
 Multiplies matrix and vector2. More...
 
kzFloat kzcMatrix2x2Trace (const struct KzcMatrix2x2 *matrix)
 Returns matrix's trace. More...
 
kzFloat kzcMatrix2x2Determinant (const struct KzcMatrix2x2 *matrix)
 Returns the determinant of the matrix. More...
 
KZ_INLINE kzBool kzcMatrix2x2IsEqual (const struct KzcMatrix2x2 *matrixA, const struct KzcMatrix2x2 *matrixB)
 Compares 2 matrices if they are equal. More...
 

Variables

struct KzcMatrix2x2 KZC_MATRIX2X2_IDENTITY
 Constant for identity matrix. More...
 

Detailed Description

Matrix2x2 structure and operations.

Copyright 2008-2019 by Rightware. All rights reserved.

Macro Definition Documentation

#define KZC_MATRIX2X2_INDEX_AXISX_X

Matrix index for coordinate X of X axis.

#define KZC_MATRIX2X2_INDEX_AXISX_Y

Matrix index for coordinate Y of X axis.

#define KZC_MATRIX2X2_INDEX_AXISY_X

Matrix index for coordinate X of Y axis.

#define KZC_MATRIX2X2_INDEX_AXISY_Y

Matrix index for coordinate Y of Y axis.

Function Documentation

KZ_INLINE struct KzcMatrix2x2 kzcMatrix2x2 ( kzFloat  a11,
kzFloat  a12,
kzFloat  a21,
kzFloat  a22 
)

Creates a matrix with given values.

void kzcMatrix2x2Copy ( const struct KzcMatrix2x2 sourceMatrix,
struct KzcMatrix2x2 targetMatrix 
)

Create a copy of matrix.

void kzcMatrix2x2SetIdentity ( struct KzcMatrix2x2 matrix)

Sets an identity matrix.

void kzcMatrix2x2SetInvalid ( struct KzcMatrix2x2 matrix)

Sets an invalid matrix filled with NaNs.

void kzcMatrix2x2Transpose ( const struct KzcMatrix2x2 matrix,
struct KzcMatrix2x2 out_matrix 
)

Applies a transpose to a matrix.

out_matrix cannot be same as input matrix.

kzBool kzcMatrix2x2Inverse ( const struct KzcMatrix2x2 matrix,
struct KzcMatrix2x2 out_matrix 
)

Applies an inversion to a matrix.

out_matrix cannot be same as input matrix. Returns KZ_TRUE if the matrix was invertible, KZ_FALSE otherwise.

void kzcMatrix2x2Rotate ( struct KzcMatrix2x2 matrix,
kzFloat  angleInRadians 
)

Applies rotation to a matrix, rotation angle in radians.

KZ_INLINE void kzcMatrix2x2RotateInDegrees ( struct KzcMatrix2x2 matrix,
kzFloat  angleInDegrees 
)

Applies rotation to a matrix, rotation angle in degrees.

void kzcMatrix2x2ScaleUniform ( struct KzcMatrix2x2 matrix,
kzFloat  scale 
)

Applies an uniform scaling for a matrix.

void kzcMatrix2x2Scale ( struct KzcMatrix2x2 matrix,
kzFloat  scaleX,
kzFloat  scaleY 
)

Applies a scaling for a matrix.

kzFloat kzcMatrix2x2GetScaleX ( const struct KzcMatrix2x2 matrix)

Gets scaling factor from matrix for its X axis.

Does not treat matrix as affine.

kzFloat kzcMatrix2x2GetScaleY ( const struct KzcMatrix2x2 matrix)

Gets scaling factor from matrix for its Y axis.

Does not treat matrix as affine.

void kzcMatrix2x2ScaleX ( struct KzcMatrix2x2 matrix,
kzFloat  scale 
)

Applies a scaling for a matrix on axis X.

void kzcMatrix2x2ScaleY ( struct KzcMatrix2x2 matrix,
kzFloat  scale 
)

Applies a scaling for a matrix on axis Y.

KZ_INLINE void kzcMatrix2x2GetAxisX ( const struct KzcMatrix2x2 matrix,
struct KzcVector2 out_axis 
)

Returns the X axis vector of the matrix.

KZ_INLINE void kzcMatrix2x2GetAxisY ( const struct KzcMatrix2x2 matrix,
struct KzcVector2 out_axis 
)

Returns the Y axis vector of the matrix.

KZ_INLINE void kzcMatrix2x2SetAxisXVector2 ( struct KzcMatrix2x2 matrix,
const struct KzcVector2 axis 
)

Sets the X axis vector of the matrix.

KZ_INLINE void kzcMatrix2x2SetAxisYVector2 ( struct KzcMatrix2x2 matrix,
const struct KzcVector2 axis 
)

Sets the Y axis vector of the matrix.

void kzcMatrix2x2Multiply ( const struct KzcMatrix2x2 matrix1,
const struct KzcMatrix2x2 matrix2,
struct KzcMatrix2x2 out_matrix 
)

Multiplies two matrices.

The result, product 'matrix1' * 'matrix2', is set to out_matrix. out_matrix cannot be any of the input matrices.

void kzcMatrix2x2MultiplyVector2 ( const struct KzcMatrix2x2 matrix,
const struct KzcVector2 vector,
struct KzcVector2 out_vector 
)

Multiplies matrix and vector2.

out_vector cannot be same as input vector.

kzFloat kzcMatrix2x2Trace ( const struct KzcMatrix2x2 matrix)

Returns matrix's trace.

kzFloat kzcMatrix2x2Determinant ( const struct KzcMatrix2x2 matrix)

Returns the determinant of the matrix.

KZ_INLINE kzBool kzcMatrix2x2IsEqual ( const struct KzcMatrix2x2 matrixA,
const struct KzcMatrix2x2 matrixB 
)

Compares 2 matrices if they are equal.

Variable Documentation

struct KzcMatrix2x2 KZC_MATRIX2X2_IDENTITY

Constant for identity matrix.