RetroArch
Classes | Macros | Typedefs | Functions
matrix_3x3.h File Reference
#include <boolean.h>
#include <math.h>
#include <string.h>
#include <retro_common_api.h>
#include <retro_inline.h>
Include dependency graph for matrix_3x3.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  math_matrix_3x3
 

Macros

#define MAT_ELEM_3X3(mat, r, c)   ((mat).data[3 * (r) + (c)])
 
#define matrix_3x3_init(mat, n11, n12, n13, n21, n22, n23, n31, n32, n33)
 
#define matrix_3x3_identity(mat)
 
#define matrix_3x3_divide_scalar(mat, s)
 
#define matrix_3x3_transpose(mat, in)
 
#define matrix_3x3_multiply(out, a, b)
 
#define matrix_3x3_determinant(mat)   (MAT_ELEM_3X3(mat, 0, 0) * (MAT_ELEM_3X3(mat, 1, 1) * MAT_ELEM_3X3(mat, 2, 2) - MAT_ELEM_3X3(mat, 1, 2) * MAT_ELEM_3X3(mat, 2, 1)) - MAT_ELEM_3X3(mat, 0, 1) * (MAT_ELEM_3X3(mat, 1, 0) * MAT_ELEM_3X3(mat, 2, 2) - MAT_ELEM_3X3(mat, 1, 2) * MAT_ELEM_3X3(mat, 2, 0)) + MAT_ELEM_3X3(mat, 0, 2) * (MAT_ELEM_3X3(mat, 1, 0) * MAT_ELEM_3X3(mat, 2, 1) - MAT_ELEM_3X3(mat, 1, 1) * MAT_ELEM_3X3(mat, 2, 0)))
 
#define matrix_3x3_adjoint(mat)
 
#define FLOATS_ARE_EQUAL(x, y)   (fabs(x - y) <= 0.00001f * ((x) > (y) ? (y) : (x)))
 
#define FLOAT_IS_ZERO(x)   (FLOATS_ARE_EQUAL((x) + 1, 1))
 

Typedefs

typedef RETRO_BEGIN_DECLS struct math_matrix_3x3 math_matrix_3x3
 

Functions

static INLINE bool matrix_3x3_invert (math_matrix_3x3 *mat)
 
static INLINE bool matrix_3x3_square_to_quad (const float dx0, const float dy0, const float dx1, const float dy1, const float dx3, const float dy3, const float dx2, const float dy2, math_matrix_3x3 *mat)
 
static INLINE bool matrix_3x3_quad_to_square (const float sx0, const float sy0, const float sx1, const float sy1, const float sx2, const float sy2, const float sx3, const float sy3, math_matrix_3x3 *mat)
 
static INLINE bool matrix_3x3_quad_to_quad (const float dx0, const float dy0, const float dx1, const float dy1, const float dx2, const float dy2, const float dx3, const float dy3, const float sx0, const float sy0, const float sx1, const float sy1, const float sx2, const float sy2, const float sx3, const float sy3, math_matrix_3x3 *mat)
 

Macro Definition Documentation

◆ FLOAT_IS_ZERO

#define FLOAT_IS_ZERO (   x)    (FLOATS_ARE_EQUAL((x) + 1, 1))

◆ FLOATS_ARE_EQUAL

#define FLOATS_ARE_EQUAL (   x,
  y 
)    (fabs(x - y) <= 0.00001f * ((x) > (y) ? (y) : (x)))

◆ MAT_ELEM_3X3

#define MAT_ELEM_3X3 (   mat,
  r,
  c 
)    ((mat).data[3 * (r) + (c)])

◆ matrix_3x3_adjoint

#define matrix_3x3_adjoint (   mat)
Value:
MAT_ELEM_3X3(mat, 0, 0) = (MAT_ELEM_3X3(mat, 1, 1) * MAT_ELEM_3X3(mat, 2, 2) - MAT_ELEM_3X3(mat, 1, 2) * MAT_ELEM_3X3(mat, 2, 1)); \
MAT_ELEM_3X3(mat, 0, 1) = -(MAT_ELEM_3X3(mat, 0, 1) * MAT_ELEM_3X3(mat, 2, 2) - MAT_ELEM_3X3(mat, 0, 2) * MAT_ELEM_3X3(mat, 2, 1)); \
MAT_ELEM_3X3(mat, 0, 2) = (MAT_ELEM_3X3(mat, 0, 1) * MAT_ELEM_3X3(mat, 1, 1) - MAT_ELEM_3X3(mat, 0, 2) * MAT_ELEM_3X3(mat, 1, 1)); \
MAT_ELEM_3X3(mat, 1, 0) = -(MAT_ELEM_3X3(mat, 1, 0) * MAT_ELEM_3X3(mat, 2, 2) - MAT_ELEM_3X3(mat, 1, 2) * MAT_ELEM_3X3(mat, 2, 0)); \
MAT_ELEM_3X3(mat, 1, 1) = (MAT_ELEM_3X3(mat, 0, 0) * MAT_ELEM_3X3(mat, 2, 2) - MAT_ELEM_3X3(mat, 0, 2) * MAT_ELEM_3X3(mat, 2, 0)); \
MAT_ELEM_3X3(mat, 1, 2) = -(MAT_ELEM_3X3(mat, 0, 0) * MAT_ELEM_3X3(mat, 1, 2) - MAT_ELEM_3X3(mat, 0, 2) * MAT_ELEM_3X3(mat, 1, 0)); \
MAT_ELEM_3X3(mat, 2, 0) = (MAT_ELEM_3X3(mat, 1, 0) * MAT_ELEM_3X3(mat, 2, 1) - MAT_ELEM_3X3(mat, 1, 1) * MAT_ELEM_3X3(mat, 2, 0)); \
MAT_ELEM_3X3(mat, 2, 1) = -(MAT_ELEM_3X3(mat, 0, 0) * MAT_ELEM_3X3(mat, 2, 1) - MAT_ELEM_3X3(mat, 0, 1) * MAT_ELEM_3X3(mat, 2, 0)); \
MAT_ELEM_3X3(mat, 2, 2) = (MAT_ELEM_3X3(mat, 0, 0) * MAT_ELEM_3X3(mat, 1, 1) - MAT_ELEM_3X3(mat, 0, 1) * MAT_ELEM_3X3(mat, 1, 0))
#define MAT_ELEM_3X3(mat, r, c)
Definition: matrix_3x3.h:40

◆ matrix_3x3_determinant

#define matrix_3x3_determinant (   mat)    (MAT_ELEM_3X3(mat, 0, 0) * (MAT_ELEM_3X3(mat, 1, 1) * MAT_ELEM_3X3(mat, 2, 2) - MAT_ELEM_3X3(mat, 1, 2) * MAT_ELEM_3X3(mat, 2, 1)) - MAT_ELEM_3X3(mat, 0, 1) * (MAT_ELEM_3X3(mat, 1, 0) * MAT_ELEM_3X3(mat, 2, 2) - MAT_ELEM_3X3(mat, 1, 2) * MAT_ELEM_3X3(mat, 2, 0)) + MAT_ELEM_3X3(mat, 0, 2) * (MAT_ELEM_3X3(mat, 1, 0) * MAT_ELEM_3X3(mat, 2, 1) - MAT_ELEM_3X3(mat, 1, 1) * MAT_ELEM_3X3(mat, 2, 0)))

◆ matrix_3x3_divide_scalar

#define matrix_3x3_divide_scalar (   mat,
  s 
)
Value:
MAT_ELEM_3X3(mat, 0, 0) /= s; \
MAT_ELEM_3X3(mat, 0, 1) /= s; \
MAT_ELEM_3X3(mat, 0, 2) /= s; \
MAT_ELEM_3X3(mat, 1, 0) /= s; \
MAT_ELEM_3X3(mat, 1, 1) /= s; \
MAT_ELEM_3X3(mat, 1, 2) /= s; \
MAT_ELEM_3X3(mat, 2, 0) /= s; \
MAT_ELEM_3X3(mat, 2, 1) /= s; \
MAT_ELEM_3X3(mat, 2, 2) /= s
GLdouble s
Definition: glext.h:6390
#define MAT_ELEM_3X3(mat, r, c)
Definition: matrix_3x3.h:40

◆ matrix_3x3_identity

#define matrix_3x3_identity (   mat)
Value:
MAT_ELEM_3X3(mat, 0, 0) = 1.0f; \
MAT_ELEM_3X3(mat, 0, 1) = 0; \
MAT_ELEM_3X3(mat, 0, 2) = 0; \
MAT_ELEM_3X3(mat, 1, 0) = 0; \
MAT_ELEM_3X3(mat, 1, 1) = 1.0f; \
MAT_ELEM_3X3(mat, 1, 2) = 0; \
MAT_ELEM_3X3(mat, 2, 0) = 0; \
MAT_ELEM_3X3(mat, 2, 1) = 0; \
MAT_ELEM_3X3(mat, 2, 2) = 1.0f
#define MAT_ELEM_3X3(mat, r, c)
Definition: matrix_3x3.h:40

◆ matrix_3x3_init

#define matrix_3x3_init (   mat,
  n11,
  n12,
  n13,
  n21,
  n22,
  n23,
  n31,
  n32,
  n33 
)
Value:
MAT_ELEM_3X3(mat, 0, 0) = n11; \
MAT_ELEM_3X3(mat, 0, 1) = n12; \
MAT_ELEM_3X3(mat, 0, 2) = n13; \
MAT_ELEM_3X3(mat, 1, 0) = n21; \
MAT_ELEM_3X3(mat, 1, 1) = n22; \
MAT_ELEM_3X3(mat, 1, 2) = n23; \
MAT_ELEM_3X3(mat, 2, 0) = n31; \
MAT_ELEM_3X3(mat, 2, 1) = n32; \
MAT_ELEM_3X3(mat, 2, 2) = n33
#define MAT_ELEM_3X3(mat, r, c)
Definition: matrix_3x3.h:40

◆ matrix_3x3_multiply

#define matrix_3x3_multiply (   out,
  a,
  b 
)

◆ matrix_3x3_transpose

#define matrix_3x3_transpose (   mat,
  in 
)
Value:
MAT_ELEM_3X3(mat, 0, 0) = MAT_ELEM_3X3(in, 0, 0); \
MAT_ELEM_3X3(mat, 1, 0) = MAT_ELEM_3X3(in, 0, 1); \
MAT_ELEM_3X3(mat, 2, 0) = MAT_ELEM_3X3(in, 0, 2); \
MAT_ELEM_3X3(mat, 0, 1) = MAT_ELEM_3X3(in, 1, 0); \
MAT_ELEM_3X3(mat, 1, 1) = MAT_ELEM_3X3(in, 1, 1); \
MAT_ELEM_3X3(mat, 2, 1) = MAT_ELEM_3X3(in, 1, 2); \
MAT_ELEM_3X3(mat, 0, 2) = MAT_ELEM_3X3(in, 2, 0); \
MAT_ELEM_3X3(mat, 1, 2) = MAT_ELEM_3X3(in, 2, 1); \
MAT_ELEM_3X3(mat, 2, 2) = MAT_ELEM_3X3(in, 2, 2)
#define MAT_ELEM_3X3(mat, r, c)
Definition: matrix_3x3.h:40
GLuint in
Definition: glext.h:10523

Typedef Documentation

◆ math_matrix_3x3

Function Documentation

◆ matrix_3x3_invert()

static INLINE bool matrix_3x3_invert ( math_matrix_3x3 mat)
static
Here is the caller graph for this function:

◆ matrix_3x3_quad_to_quad()

static INLINE bool matrix_3x3_quad_to_quad ( const float  dx0,
const float  dy0,
const float  dx1,
const float  dy1,
const float  dx2,
const float  dy2,
const float  dx3,
const float  dy3,
const float  sx0,
const float  sy0,
const float  sx1,
const float  sy1,
const float  sx2,
const float  sy2,
const float  sx3,
const float  sy3,
math_matrix_3x3 mat 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ matrix_3x3_quad_to_square()

static INLINE bool matrix_3x3_quad_to_square ( const float  sx0,
const float  sy0,
const float  sx1,
const float  sy1,
const float  sx2,
const float  sy2,
const float  sx3,
const float  sy3,
math_matrix_3x3 mat 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ matrix_3x3_square_to_quad()

static INLINE bool matrix_3x3_square_to_quad ( const float  dx0,
const float  dy0,
const float  dx1,
const float  dy1,
const float  dx3,
const float  dy3,
const float  dx2,
const float  dy2,
math_matrix_3x3 mat 
)
static
Here is the caller graph for this function: