Data Structures | Macros | Typedefs | Functions
Matrices in floating point

Matrix definition and operations. More...

Data Structures

struct  _Eina_Matrix3
 

Macros

#define EINA_MATRIX3_FORMAT   "g %g %g | %g %g %g | %g %g %g"
 Helper macro for printf formatting.
 
#define EINA_MATRIX3_ARGS(m)
 Helper macro for printf formatting arg. More...
 

Typedefs

typedef struct _Eina_Matrix3 Eina_Matrix3
 Floating point matrix3 handler.
 

Functions

EAPI Eina_Matrix_Type eina_matrix3_type_get (const Eina_Matrix3 *m)
 Return the type of the given floating point matrix. More...
 
EAPI void eina_matrix3_values_set (Eina_Matrix3 *m, double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz)
 Set the values of the coefficients of the given floating point matrix. More...
 
EAPI void eina_matrix3_values_get (const Eina_Matrix3 *m, double *xx, double *xy, double *xz, double *yx, double *yy, double *yz, double *zx, double *zy, double *zz)
 Get the values of the coefficients of the given floating point matrix. More...
 
EAPI void eina_matrix3_fixed_values_get (const Eina_Matrix3 *m, Eina_F16p16 *xx, Eina_F16p16 *xy, Eina_F16p16 *xz, Eina_F16p16 *yx, Eina_F16p16 *yy, Eina_F16p16 *yz, Eina_F16p16 *zx, Eina_F16p16 *zy, Eina_F16p16 *zz)
 Get the values of the coefficients of the given fixed point matrix. More...
 
EAPI void eina_matrix3_matrix3_f16p16_to (const Eina_Matrix3 *m, Eina_Matrix3_F16p16 *fm)
 Transform the given floating point matrix to the given fixed point matrix. More...
 
EAPI Eina_Bool eina_matrix3_equal (const Eina_Matrix3 *m1, const Eina_Matrix3 *m2)
 Check whether the two given matrices are equal or not. More...
 
EAPI void eina_matrix3_compose (const Eina_Matrix3 *m1, const Eina_Matrix3 *m2, Eina_Matrix3 *dst)
 
EAPI void eina_matrix3_translate (Eina_Matrix3 *t, double tx, double ty)
 Set the matrix values for a translation. More...
 
EAPI void eina_matrix3_scale (Eina_Matrix3 *t, double sx, double sy)
 Set the matrix values for a scale. More...
 
EAPI void eina_matrix3_rotate (Eina_Matrix3 *t, double rad)
 Set the matrix values for a rotation. More...
 
EAPI void eina_matrix3_identity (Eina_Matrix3 *t)
 Set the given floating point matrix to the identity matrix. More...
 
EAPI double eina_matrix3_determinant (const Eina_Matrix3 *m)
 Return the determinant of the given matrix. More...
 
EAPI void eina_matrix3_divide (Eina_Matrix3 *m, double scalar)
 Divide the given matrix by the given scalar. More...
 
EAPI void eina_matrix3_inverse (const Eina_Matrix3 *m, Eina_Matrix3 *m2)
 Compute the inverse of the given matrix. More...
 
EAPI void eina_matrix3_transpose (const Eina_Matrix3 *m, Eina_Matrix3 *a)
 
EAPI void eina_matrix3_cofactor (const Eina_Matrix3 *m, Eina_Matrix3 *a)
 
EAPI void eina_matrix3_adjoint (const Eina_Matrix3 *m, Eina_Matrix3 *a)
 
EAPI void eina_matrix3_point_transform (const Eina_Matrix3 *m, double x, double y, double *xr, double *yr)
 
EAPI void eina_matrix3_rectangle_transform (const Eina_Matrix3 *m, const Eina_Rectangle *r, const Eina_Quad *q)
 
EAPI Eina_Bool eina_matrix3_quad_quad_map (Eina_Matrix3 *m, const Eina_Quad *src, const Eina_Quad *dst)
 Creates a projective matrix that maps a quadrangle to a quadrangle.
 
EAPI Eina_Bool eina_matrix3_square_quad_map (Eina_Matrix3 *m, const Eina_Quad *q)
 
EAPI Eina_Bool eina_matrix3_quad_square_map (Eina_Matrix3 *m, const Eina_Quad *q)
 

Detailed Description

Matrix definition and operations.

Macro Definition Documentation

§ EINA_MATRIX3_ARGS

#define EINA_MATRIX3_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

§ eina_matrix3_type_get()

EAPI Eina_Matrix_Type eina_matrix3_type_get ( const Eina_Matrix3 m)

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.

Since
1.14

References EINA_MATRIX_TYPE_AFFINE, EINA_MATRIX_TYPE_IDENTITY, and EINA_MATRIX_TYPE_PROJECTIVE.

§ eina_matrix3_values_set()

EAPI void eina_matrix3_values_set ( Eina_Matrix3 m,
double  xx,
double  xy,
double  xz,
double  yx,
double  yy,
double  yz,
double  zx,
double  zy,
double  zz 
)

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

Parameters
mThe floating point matrix.
xxThe first coefficient value.
xyThe second coefficient value.
xzThe third coefficient value.
yxThe fourth coefficient value.
yyThe fifth coefficient value.
yzThe sixth coefficient value.
zxThe seventh coefficient value.
zyThe heighth coefficient value.
zzThe nineth coefficient value.

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

See also
eina_matrix3_values_get()
Since
1.14

§ eina_matrix3_values_get()

EAPI void eina_matrix3_values_get ( const Eina_Matrix3 m,
double *  xx,
double *  xy,
double *  xz,
double *  yx,
double *  yy,
double *  yz,
double *  zx,
double *  zy,
double *  zz 
)

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

Parameters
mThe floating point matrix.
xxThe first coefficient value.
xyThe second coefficient value.
xzThe third coefficient value.
yxThe fourth coefficient value.
yyThe fifth coefficient value.
yzThe sixth coefficient value.
zxThe seventh coefficient value.
zyThe heighth coefficient value.
zzThe nineth coefficient value.

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

See also
eina_matrix3_values_set()
Since
1.14

§ eina_matrix3_fixed_values_get()

EAPI void eina_matrix3_fixed_values_get ( const Eina_Matrix3 m,
Eina_F16p16 xx,
Eina_F16p16 xy,
Eina_F16p16 xz,
Eina_F16p16 yx,
Eina_F16p16 yy,
Eina_F16p16 yz,
Eina_F16p16 zx,
Eina_F16p16 zy,
Eina_F16p16 zz 
)

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

Parameters
mThe fixed point matrix.
xxThe first coefficient value.
xyThe second coefficient value.
xzThe third coefficient value.
yxThe fourth coefficient value.
yyThe fifth coefficient value.
yzThe sixth coefficient value.
zxThe seventh coefficient value.
zyThe heighth coefficient value.
zzThe nineth coefficient value.

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

See also
eina_matrix3_values_set()
Since
1.14

References eina_f16p16_double_from().

Referenced by eina_matrix3_matrix3_f16p16_to().

§ eina_matrix3_matrix3_f16p16_to()

EAPI void eina_matrix3_matrix3_f16p16_to ( const Eina_Matrix3 m,
Eina_Matrix3_F16p16 fm 
)

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.

Since
1.14

References eina_matrix3_fixed_values_get(), _Eina_Matrix3_F16p16::xx, _Eina_Matrix3_F16p16::xy, _Eina_Matrix3_F16p16::xz, _Eina_Matrix3_F16p16::yx, _Eina_Matrix3_F16p16::yy, _Eina_Matrix3_F16p16::yz, _Eina_Matrix3_F16p16::zx, _Eina_Matrix3_F16p16::zy, and _Eina_Matrix3_F16p16::zz.

§ eina_matrix3_equal()

EAPI Eina_Bool eina_matrix3_equal ( const Eina_Matrix3 m1,
const Eina_Matrix3 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.

Since
1.14

References EINA_FALSE, EINA_TRUE, _Eina_Matrix3::xx, _Eina_Matrix3::xy, _Eina_Matrix3::xz, _Eina_Matrix3::yx, _Eina_Matrix3::yy, _Eina_Matrix3::yz, _Eina_Matrix3::zx, _Eina_Matrix3::zy, and _Eina_Matrix3::zz.

§ eina_matrix3_compose()

EAPI void eina_matrix3_compose ( const Eina_Matrix3 m1,
const Eina_Matrix3 m2,
Eina_Matrix3 dst 
)

§ eina_matrix3_translate()

EAPI void eina_matrix3_translate ( Eina_Matrix3 t,
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
Since
1.14

References eina_matrix3_compose().

§ eina_matrix3_scale()

EAPI void eina_matrix3_scale ( Eina_Matrix3 t,
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
Since
1.14

References eina_matrix3_compose().

§ eina_matrix3_rotate()

EAPI void eina_matrix3_rotate ( Eina_Matrix3 t,
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
Since
1.14

References eina_matrix3_compose().

§ eina_matrix3_identity()

EAPI void eina_matrix3_identity ( Eina_Matrix3 t)

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.

Since
1.14

Referenced by eina_matrix3_inverse(), eina_matrix3_position_transform_set(), and eina_matrix3_scale_transform_set().

§ eina_matrix3_determinant()

EAPI double eina_matrix3_determinant ( const Eina_Matrix3 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.

Since
1.14

Referenced by eina_matrix3_inverse().

§ eina_matrix3_divide()

EAPI void eina_matrix3_divide ( Eina_Matrix3 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.

Since
1.14

Referenced by eina_matrix3_inverse(), and eina_matrix3_quad_square_map().

§ eina_matrix3_inverse()

EAPI void eina_matrix3_inverse ( const Eina_Matrix3 m,
Eina_Matrix3 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.

Since
1.14

References eina_matrix3_adjoint(), eina_matrix3_determinant(), eina_matrix3_divide(), and eina_matrix3_identity().

Referenced by eina_matrix3_quad_square_map().

§ eina_matrix3_transpose()

EAPI void eina_matrix3_transpose ( const Eina_Matrix3 m,
Eina_Matrix3 a 
)
Since
1.14

Referenced by eina_matrix3_adjoint().

§ eina_matrix3_cofactor()

EAPI void eina_matrix3_cofactor ( const Eina_Matrix3 m,
Eina_Matrix3 a 
)
Since
1.14

Referenced by eina_matrix3_adjoint().

§ eina_matrix3_adjoint()

EAPI void eina_matrix3_adjoint ( const Eina_Matrix3 m,
Eina_Matrix3 a 
)
Since
1.14

References eina_matrix3_cofactor(), and eina_matrix3_transpose().

Referenced by eina_matrix3_inverse().

§ eina_matrix3_point_transform()

EAPI void eina_matrix3_point_transform ( const Eina_Matrix3 m,
double  x,
double  y,
double *  xr,
double *  yr 
)
Since
1.14

Referenced by eina_matrix3_rectangle_transform().

§ eina_matrix3_rectangle_transform()

EAPI void eina_matrix3_rectangle_transform ( const Eina_Matrix3 m,
const Eina_Rectangle r,
const Eina_Quad q 
)

§ eina_matrix3_square_quad_map()

EAPI Eina_Bool eina_matrix3_square_quad_map ( Eina_Matrix3 m,
const Eina_Quad q 
)
Since
1.14

References EINA_FALSE, and EINA_TRUE.

Referenced by eina_matrix3_quad_quad_map(), and eina_matrix3_quad_square_map().

§ eina_matrix3_quad_square_map()

EAPI Eina_Bool eina_matrix3_quad_square_map ( Eina_Matrix3 m,
const Eina_Quad q 
)