Tizen Native API  6.0
4x4 Matrices in floating point

Definition and operations for 4x4 matrices.

Functions

Eina_Matrix_Type eina_matrix4_type_get (const Eina_Matrix4 *m)
 Returns the type of the given floating point matrix.
void eina_matrix4_values_set (Eina_Matrix4 *m, double xx, double xy, double xz, double xw, double yx, double yy, double yz, double yw, double zx, double zy, double zz, double zw, double wx, double wy, double wz, double ww)
 Sets the values of the coefficients of the given floating point matrix.
void eina_matrix4_values_get (const Eina_Matrix4 *m, double *xx, double *xy, double *xz, double *xw, double *yx, double *yy, double *yz, double *yw, double *zx, double *zy, double *zz, double *zw, double *wx, double *wy, double *wz, double *ww)
 Gets the values of the coefficients of the given floating point matrix.
double eina_matrix4_determinant (const Eina_Matrix4 *m)
 Calculates the determinant of the given matrix.
Eina_Bool eina_matrix4_normalized (Eina_Matrix4 *out, const Eina_Matrix4 *in)
 Normalizes the given matrix.
Eina_Bool eina_matrix4_inverse (Eina_Matrix4 *out, const Eina_Matrix4 *in)
 Computes the inverse of the given matrix.
void eina_matrix4_transpose (Eina_Matrix4 *out, const Eina_Matrix4 *in)
 Computes the transpose of the given matrix.
void eina_matrix4_matrix3_to (Eina_Matrix3 *m3, const Eina_Matrix4 *m4)
 Converts an Eina_Matrix4 into an Eina_Matrix3.
void eina_matrix4_identity (Eina_Matrix4 *out)
 Sets the given matrix to identity.
void eina_matrix4_multiply_copy (Eina_Matrix4 *out, const Eina_Matrix4 *mat_a, const Eina_Matrix4 *mat_b)
 Multiplies two matrix.
void eina_matrix4_array_set (Eina_Matrix4 *m, const double *v)
 Sets matrix values using an array.
void eina_matrix4_copy (Eina_Matrix4 *dst, const Eina_Matrix4 *src)
 Copies matrix.
void eina_matrix4_multiply (Eina_Matrix4 *out, const Eina_Matrix4 *mat_a, const Eina_Matrix4 *mat_b)
 Multiplies two matrices with check.
void eina_matrix4_ortho_set (Eina_Matrix4 *m, double left, double right, double bottom, double top, double dnear, double dfar)
 Sets orthogonality matrix.
void eina_matrix4_compose (const Eina_Matrix4 *mat_a, const Eina_Matrix4 *mat_b, Eina_Matrix4 *out)
 Sets out as the matrix multiplication (composition) of two matrices.
void eina_matrix4_translate (Eina_Matrix4 *t, double tx, double ty, double tz)
 Sets the matrix values for a translation operation.
void eina_matrix4_scale (Eina_Matrix4 *t, double sx, double sy, double sz)
 Sets the matrix values for a scaling operation.
void eina_matrix4_rotate (Eina_Matrix4 *t, double rad, Eina_Matrix_Axis axis)
 Sets the matrix values for a rotation operation.

Typedefs

typedef struct _Eina_Matrix4 Eina_Matrix4

Typedef Documentation

A 4x4 floating point matrix.


Function Documentation

void eina_matrix4_array_set ( Eina_Matrix4 m,
const double *  v 
)

Sets matrix values using an array.

Parameters:
[out]mThe result matrix.
[in]vThe the array[16] of values.

Uses the first 16 elements in the given C array v to set the values in the matrix m. The values will be set in the order of the elements in the Eina_Matrix4 structure.

Since (EFL) :
1.17
Since :
3.0
void eina_matrix4_compose ( const Eina_Matrix4 mat_a,
const Eina_Matrix4 mat_b,
Eina_Matrix4 out 
)

Sets out as the matrix multiplication (composition) of two matrices.

Parameters:
[in]mat_aThe first matrix. Must be non-NULL.
[in]mat_bThe second matrix. Must be non-NULL.
[out]outThe results matrix.

In matrix multiplication, AB, the resultant matrix is created from the rows of A multiplied against the columns of B and summed. This is not commutative; i.e. AB != BA, so the ordering of arguments m1 and m2 matters.

Since (EFL) :
1.24
void eina_matrix4_copy ( Eina_Matrix4 dst,
const Eina_Matrix4 src 
)

Copies matrix.

Parameters:
[out]dstThe matrix copy.
[in]srcThe matrix to copy.
Since (EFL) :
1.17
Since :
3.0
double eina_matrix4_determinant ( const Eina_Matrix4 m)

Calculates the determinant of the given matrix.

Parameters:
[in]mThe matrix.
Returns:
The determinant.

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

Since (EFL) :
1.16
Since :
3.0

Sets the given matrix to identity.

Parameters:
[out]outThe matrix to set.
Since (EFL) :
1.16
Since :
3.0

Computes the inverse of the given matrix.

Parameters:
[out]outThe inverse matrix.
[in]inThe matrix.
Returns:
EINA_TRUE on success, EINA_FALSE otherwise.

This function inverts the matrix in and stores the result in out. No check is done on in or out. If in cannot be inverted, then EINA_FALSE is returned.

Since (EFL) :
1.16
Since :
3.0
void eina_matrix4_matrix3_to ( Eina_Matrix3 m3,
const Eina_Matrix4 m4 
)

Converts an Eina_Matrix4 into an Eina_Matrix3.

Parameters:
[out]m3The destination Eina_Matrix3.
[in]m4The source Eina_Matrix4.
Since (EFL) :
1.15
Since :
3.0
void eina_matrix4_multiply ( Eina_Matrix4 out,
const Eina_Matrix4 mat_a,
const Eina_Matrix4 mat_b 
)

Multiplies two matrices with check.

Parameters:
[out]outThe resulting matrix.
[in]mat_aThe first member of the multiplication.
[in]mat_bThe second member of the multiplication.
Since (EFL) :
1.17
Since :
3.0
void eina_matrix4_multiply_copy ( Eina_Matrix4 out,
const Eina_Matrix4 mat_a,
const Eina_Matrix4 mat_b 
)

Multiplies two matrix.

Parameters:
[out]outThe resulting matrix.
[in]mat_aThe first member of the multiplication.
[in]mat_bThe second member of the multiplication.

Safely multiplies mat_a and mat_b by checking if the out parameter points to either of them, and if so uses a temporary matrix for the intermediary calculations.

Since (EFL) :
1.17
Since :
3.0

Normalizes the given matrix.

Parameters:
[out]outThe normalized matrix.
[in]inThe matrix.
Returns:
EINA_FALSE if matrix could not be normalized, EINA_TRUE otherwise.

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

Since (EFL) :
1.16
Since :
3.0
void eina_matrix4_ortho_set ( Eina_Matrix4 m,
double  left,
double  right,
double  bottom,
double  top,
double  dnear,
double  dfar 
)

Sets orthogonality matrix.

Parameters:
[out]mThe resulting matrix.
[in]rightThe right value.
[in]leftThe left value.
[in]bottomThe bottom value.
[in]topThe top value.
[in]dnearThe dnear value.
[in]dfarThe dfar value.
Since (EFL) :
1.17
Since :
3.0
void eina_matrix4_rotate ( Eina_Matrix4 t,
double  rad,
Eina_Matrix_Axis  axis 
)

Sets the matrix values for a rotation operation.

Parameters:
[out]tWhere to store the resulting matrix.
[in]radThe number of radians to rotate.
[in]axisThe Axis of rotation.
Since (EFL) :
1.24
void eina_matrix4_scale ( Eina_Matrix4 t,
double  sx,
double  sy,
double  sz 
)

Sets the matrix values for a scaling operation.

Parameters:
[out]tWhere to store the resulting matrix.
[in]sxThe X coordinate scaling factor.
[in]syThe Y coordinate scaling factor.
[in]szThe Z coordinate scaling factor.
Since (EFL) :
1.24
void eina_matrix4_translate ( Eina_Matrix4 t,
double  tx,
double  ty,
double  tz 
)

Sets the matrix values for a translation operation.

Parameters:
[out]tWhere to store the resulting matrix.
[in]txThe X coordinate translation.
[in]tyThe Y coordinate translation.
[in]tzThe Z coordinate translation.
Since (EFL) :
1.24
void eina_matrix4_transpose ( Eina_Matrix4 out,
const Eina_Matrix4 in 
)

Computes the transpose of the given matrix.

Parameters:
[out]outThe transposed matrix.
[in]inThe source matrix.

This function transposes the matrix in and stores the result in out. No check is done on in or out. The transpose of a matrix essentially flips a matrix over its diagonal.

Since (EFL) :
1.16
Since :
3.0

Returns the type of the given floating point matrix.

Parameters:
[in]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 (EFL) :
1.15
Since :
3.0
void eina_matrix4_values_get ( const Eina_Matrix4 m,
double *  xx,
double *  xy,
double *  xz,
double *  xw,
double *  yx,
double *  yy,
double *  yz,
double *  yw,
double *  zx,
double *  zy,
double *  zz,
double *  zw,
double *  wx,
double *  wy,
double *  wz,
double *  ww 
)

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

Parameters:
[in]mThe floating point matrix.
[out]xxThe first coefficient value.
[out]xyThe second coefficient value.
[out]xzThe third coefficient value.
[out]xwThe fourth coefficient value.
[out]yxThe fifth coefficient value.
[out]yyThe sixth coefficient value.
[out]yzThe seventh coefficient value.
[out]ywThe eighth coefficient value.
[out]zxThe ninth coefficient value.
[out]zyThe tenth coefficient value.
[out]zzThe eleventh coefficient value.
[out]zwThe twelfth coefficient value.
[out]wxThe thirteenth coefficient value.
[out]wyThe fourteenth coefficient value.
[out]wzThe fifteenth coefficient value.
[out]wwThe sixteenth coefficient value.

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

See also:
eina_matrix4_values_set()
Since (EFL) :
1.15
Since :
3.0
void eina_matrix4_values_set ( Eina_Matrix4 m,
double  xx,
double  xy,
double  xz,
double  xw,
double  yx,
double  yy,
double  yz,
double  yw,
double  zx,
double  zy,
double  zz,
double  zw,
double  wx,
double  wy,
double  wz,
double  ww 
)

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

Parameters:
[out]mThe floating point matrix.
[in]xxThe first coefficient value.
[in]xyThe second coefficient value.
[in]xzThe third coefficient value.
[in]xwThe fourth coefficient value.
[in]yxThe fifth coefficient value.
[in]yyThe sixth coefficient value.
[in]yzThe seventh coefficient value.
[in]ywThe eighth coefficient value.
[in]zxThe ninth coefficient value.
[in]zyThe tenth coefficient value.
[in]zzThe eleventh coefficient value.
[in]zwThe twelfth coefficient value.
[in]wxThe thirteenth coefficient value.
[in]wyThe fourteenth coefficient value.
[in]wzThe fifteenth coefficient value.
[in]wwThe sixteenth coefficient value.

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

See also:
eina_matrix4_values_get()
Since (EFL) :
1.15
Since :
3.0