enesim  0.0.23.1
Drawinglibrary
Data Structures | Defines | Functions
Matrices in floating point
Basic types

Matrix definition and operations. More...

Data Structures

struct  Enesim_Matrix

Defines

#define ENESIM_MATRIX_FORMAT   "f %f %f | %f %f %f | %f %f %f"
#define ENESIM_MATRIX_ARGS(m)

Functions

EAPI Enesim_Matrix_Type enesim_matrix_type_get (const Enesim_Matrix *m)
 Return the type of the given floating point matrix.
EAPI void enesim_matrix_values_set (Enesim_Matrix *m, double a, double b, double c, double d, double e, double f, double g, double h, double i)
 Set the values of the coefficients of the given floating point matrix.
EAPI void enesim_matrix_values_get (const Enesim_Matrix *m, double *a, double *b, double *c, double *d, double *e, double *f, double *g, double *h, double *i)
 Get the values of the coefficients of the given floating point matrix.
EAPI void enesim_matrix_fixed_values_get (const Enesim_Matrix *m, Eina_F16p16 *a, Eina_F16p16 *b, Eina_F16p16 *c, Eina_F16p16 *d, Eina_F16p16 *e, Eina_F16p16 *f, Eina_F16p16 *g, Eina_F16p16 *h, Eina_F16p16 *i)
 Get the values of the coefficients of the given fixed point matrix.
EAPI void enesim_matrix_matrix_f16p16_to (const Enesim_Matrix *m, Enesim_Matrix_F16p16 *fm)
 Transform the given floating point matrix to the given fixed point matrix.
EAPI Eina_Bool enesim_matrix_is_equal (const Enesim_Matrix *m1, const Enesim_Matrix *m2)
 Check whether the two given matrices are equal or not.
EAPI void enesim_matrix_compose (const Enesim_Matrix *m1, const Enesim_Matrix *m2, Enesim_Matrix *dst)
EAPI void enesim_matrix_translate (Enesim_Matrix *t, double tx, double ty)
EAPI void enesim_matrix_scale (Enesim_Matrix *t, double sx, double sy)
EAPI void enesim_matrix_rotate (Enesim_Matrix *t, double rad)
EAPI void enesim_matrix_identity (Enesim_Matrix *t)
 Set the given floating point matrix to the identity matrix.
EAPI double enesim_matrix_determinant (const Enesim_Matrix *m)
 Return the determinant of the given matrix.
EAPI void enesim_matrix_divide (Enesim_Matrix *m, double scalar)
 Divide the given matrix by the given scalar.
EAPI void enesim_matrix_inverse (const Enesim_Matrix *m, Enesim_Matrix *m2)
 Compute the inverse of the given matrix.
EAPI void enesim_matrix_transpose (const Enesim_Matrix *m, Enesim_Matrix *a)
EAPI void enesim_matrix_cofactor (const Enesim_Matrix *m, Enesim_Matrix *a)
EAPI void enesim_matrix_adjoint (const Enesim_Matrix *m, Enesim_Matrix *a)
EAPI void enesim_matrix_point_transform (const Enesim_Matrix *m, double x, double y, double *xr, double *yr)
EAPI void enesim_matrix_eina_rectangle_transform (const Enesim_Matrix *m, const Eina_Rectangle *r, const Enesim_Quad *q)
EAPI void enesim_matrix_rectangle_transform (const Enesim_Matrix *m, const Enesim_Rectangle *r, const Enesim_Quad *q)
EAPI Eina_Bool enesim_matrix_quad_quad_map (Enesim_Matrix *m, const Enesim_Quad *src, const Enesim_Quad *dst)
EAPI Eina_Bool enesim_matrix_square_quad_map (Enesim_Matrix *m, const Enesim_Quad *q)
EAPI Eina_Bool enesim_matrix_quad_square_map (Enesim_Matrix *m, const Enesim_Quad *q)

Detailed Description

Matrix definition and operations.


Define Documentation

#define ENESIM_MATRIX_FORMAT   "f %f %f | %f %f %f | %f %f %f"

Helper macro for printf formatting

#define ENESIM_MATRIX_ARGS (   m)
Value:
(m)->xx, (m)->xy, (m)->xz,  \
        (m)->yx, (m)->yy, (m)->yz,          \
        (m)->zx, (m)->zy, (m)->zz

Helper macro for printf formatting arg


Function Documentation

Return the type of the given floating point matrix.

Parameters:
mThe floating point matrix.
Returns:
The type of the matrix.

This function returns the type of the matrix m. No check is done on m.

EAPI void enesim_matrix_values_set ( Enesim_Matrix m,
double  a,
double  b,
double  c,
double  d,
double  e,
double  f,
double  g,
double  h,
double  i 
)

Set the values of the coefficients of the given floating point matrix.

Parameters:
mThe floating point matrix.
aThe first coefficient value.
bThe second coefficient value.
cThe third coefficient value.
dThe fourth coefficient value.
eThe fifth coefficient value.
fThe sixth coefficient value.
gThe seventh coefficient value.
hThe heighth coefficient value.
iThe nineth coefficient value.

This function sets the values of the coefficients of the matrix m. No check is done on m.

See also:
enesim_matrix_values_get()
EAPI void enesim_matrix_values_get ( const Enesim_Matrix m,
double *  a,
double *  b,
double *  c,
double *  d,
double *  e,
double *  f,
double *  g,
double *  h,
double *  i 
)

Get the values of the coefficients of the given floating point matrix.

Parameters:
mThe floating point matrix.
aThe first coefficient value.
bThe second coefficient value.
cThe third coefficient value.
dThe fourth coefficient value.
eThe fifth coefficient value.
fThe sixth coefficient value.
gThe seventh coefficient value.
hThe heighth coefficient value.
iThe nineth coefficient value.

This function gets the values of the coefficients of the matrix m. No check is done on m.

See also:
enesim_matrix_values_set()
EAPI void enesim_matrix_fixed_values_get ( const Enesim_Matrix m,
Eina_F16p16 *  a,
Eina_F16p16 *  b,
Eina_F16p16 *  c,
Eina_F16p16 *  d,
Eina_F16p16 *  e,
Eina_F16p16 *  f,
Eina_F16p16 *  g,
Eina_F16p16 *  h,
Eina_F16p16 *  i 
)

Get the values of the coefficients of the given fixed point matrix.

Parameters:
mThe fixed point matrix.
aThe first coefficient value.
bThe second coefficient value.
cThe third coefficient value.
dThe fourth coefficient value.
eThe fifth coefficient value.
fThe sixth coefficient value.
gThe seventh coefficient value.
hThe heighth coefficient value.
iThe nineth coefficient value.

This function gets the values of the coefficients of the matrix m. No check is done on m.

See also:
enesim_matrix_values_set()

Transform the given floating point matrix to the given fixed point matrix.

Parameters:
mThe floating point matrix.
fmThe fixed point matrix.

This function transforms the floating point matrix m to a fixed point matrix and store the coefficients into the fixed point matrix fm.

EAPI Eina_Bool enesim_matrix_is_equal ( const Enesim_Matrix m1,
const Enesim_Matrix m2 
)

Check whether the two given matrices are equal or not.

Parameters:
m1The first matrix.
m2The second matrix.
Returns:
EINA_TRUE if the two matrices are equal, 0 otherwise.

This function return EINA_TRUE if thematrices m1 and m2 are equal, EINA_FALSE otherwise. No check is done on the matrices.

EAPI void enesim_matrix_translate ( Enesim_Matrix m,
double  tx,
double  ty 
)

Set the matrix values for a translation

Parameters:
[in]mThe matrix to set the translation values
[in]txThe X coordinate translate
[in]tyThe Y coordinate translate
EAPI void enesim_matrix_scale ( Enesim_Matrix m,
double  sx,
double  sy 
)

Set the matrix values for a scale

Parameters:
[in]mThe matrix to set the scale values
[in]sxThe X coordinate scale
[in]syThe Y coordinate scale
EAPI void enesim_matrix_rotate ( Enesim_Matrix m,
double  rad 
)

Set the matrix values for a rotation

Parameters:
[in]mThe matrix to set the rotation values
[in]radThe radius to rotate the matrix

Set the given floating point matrix to the identity matrix.

Parameters:
mThe floating point matrix to set

This function sets m to the identity matrix. No check is done on m.

EAPI double enesim_matrix_determinant ( const Enesim_Matrix m)

Return the determinant of the given matrix.

Parameters:
mThe matrix.
Returns:
The determinant.

This function returns the determinant of the matrix m. No check is done on m.

EAPI void enesim_matrix_divide ( Enesim_Matrix m,
double  scalar 
)

Divide the given matrix by the given scalar.

Parameters:
mThe matrix.
scalarThe scalar number.

This function divides the matrix m by scalar. No check is done on m.

EAPI void enesim_matrix_inverse ( const Enesim_Matrix m,
Enesim_Matrix m2 
)

Compute the inverse of the given matrix.

Parameters:
mThe matrix to inverse.
m2The inverse matrix.

This function inverse the matrix m and stores the result in m2. No check is done on m or m2. If m can not be invertible, then m2 is set to the identity matrix.

EAPI Eina_Bool enesim_matrix_quad_quad_map ( Enesim_Matrix m,
const Enesim_Quad src,
const Enesim_Quad dst 
)

Creates a projective matrix that maps a quadrangle to a quadrangle

 All Data Structures Variables