35 #ifndef AMINO_TF_PLANAR_H
36 #define AMINO_TF_PLANAR_H
46 #define AA_TF_CMPLX(x, y) ((x) + _Complex_I * (y))
49 #define AA_TF_CMPLX_REAL(c) (creal(c))
52 #define AA_TF_CMPLX_IMAG(c) (cimag(c))
55 #define AA_TF_VEC2(x, y) AA_TF_CMPLX(x, y)
58 #define AA_TF_VEC2_X(v) AA_TF_CMPLX_REAL(v)
61 #define AA_TF_VEC2_Y(v) AA_TF_CMPLX_IMAG(v)
64 #define AA_TF_VEC2_LD(ptr) AA_TF_VEC2((ptr)[0], (ptr)[1])
67 #define AA_TF_VEC2_ST(v, ptr) \
69 (ptr)[0] = AA_TF_VEC2_X(v); \
70 (ptr)[1] = AA_TF_VEC2_Y(v); \
74 #define AA_TF_ROTMATP_IDENT_INITIALIZER {1,0, 0,1};
78 #define AA_TF_COTR_IDENT_INITIALIZER {1,0, 0,0 };
81 #define AA_TF_TFMATP_IDENT_INITIALIZER {1,0, 0,1, 0,0};
84 #define AA_TF_CMPLX_IDENT AA_TF_CMPLX(1, 0)
#define AA_API
calling and name mangling convention for functions
#define AA_RESTRICT
Defined restrict keyword based on language flavor.
AA_API void aa_tf_cv_inv(const aa_tf_cmplx c, const aa_tf_vec2 v, aa_tf_cmplx *ci, aa_tf_vec2 *vi)
Invert a complex number and translation vector planar transform.
AA_API void aa_tf_rotmatp_mul(const double R1[AA_RESTRICT 4], const double R2[AA_RESTRICT 4], double R12[AA_RESTRICT 4])
Multiply planar rotation matrices.
AA_API double aa_tf_rotmatp2angle(const double R[AA_RESTRICT 4])
Convert a planar rotation matrix to a rotation angle.
AA_API void aa_tf_angle2rotmatp(double angle, double R[AA_RESTRICT 4])
Convert a rotation angle to a planar rotation matrix.
AA_API double aa_tf_rotmatp_uln(const double R[4])
Logarithm of a planar rotation matrix.
AA_API aa_tf_vec2 aa_tf_cv_tf(const aa_tf_cmplx c, const aa_tf_vec2 v, const aa_tf_vec2 p)
Apply a planar transform represented with a complex number and translation vector.
AA_API double aa_tf_cmplx2angle(const aa_tf_cmplx c)
Convert a complex number to a rotation angle.
AA_API aa_tf_cmplx aa_tf_cpexp(double theta)
Exponential of a pure (zero real part) complex number.
AA_API void aa_tf_tfmatp_mul(const double T1[AA_RESTRICT 6], const double T2[AA_RESTRICT 6], double T12[AA_RESTRICT 6])
Multiply (chain) two complex number and translation vector planar transforms.
AA_API void aa_tf_tfmatp2cv(const double T[AA_RESTRICT 6], aa_tf_cmplx *c, aa_tf_vec2 *v)
Convert a planar transformation matrix to a complex number and translation vector.
AA_API void aa_tf_rotmatp_pexp(double angle, double R[AA_RESTRICT 4])
Exponential of a pure (zero real part) complex number as a rotation matrix.
AA_API double aa_tf_culn(const aa_tf_cmplx c)
Logarithm of a unit complex number.
AA_API aa_tf_cmplx aa_tf_cconj(const aa_tf_cmplx c)
Conjugate a complex number, giving the inverse rotation.
AA_API void aa_tf_tfmatp_inv2(const double T[AA_RESTRICT 6], double Ti[AA_RESTRICT 6])
Invert a planar transformation matrix.
AA_API void aa_tf_rotmatp_inv2(const double R[AA_RESTRICT 4], double Ri[AA_RESTRICT 4])
Invert a planar rotation matrix.
AA_API void aa_tf_cv2tfmatp(const aa_tf_cmplx c, const aa_tf_vec2 v, double T[AA_RESTRICT 6])
Convert a complex number and translation vector to a planar transformation matrix.
AA_API aa_tf_vec2 aa_tf_crot(const aa_tf_cmplx c, const aa_tf_vec2 v)
Apply a planar rotation via complex number.
AA_API void aa_tf_cmplx2rotmatp(const aa_tf_cmplx c, double R[AA_RESTRICT 4])
Convert a unit complex number to a rotation matrix.
AA_API aa_tf_vec2 aa_tf_tfmatp_tf(const double T[AA_RESTRICT 6], const aa_tf_vec2 p)
Apply a planar transform represented matrix.
AA_API aa_tf_vec2 aa_tf_rotmatp_rot(const double R[AA_RESTRICT 4], const aa_tf_vec2 v)
Apply a planar rotation via rotation matrix.
AA_API aa_tf_cmplx aa_tf_cmul(const aa_tf_cmplx c1, const aa_tf_cmplx c2)
Multiply complex numbers.
AA_API aa_tf_cmplx aa_tf_rotmatp2cmplx(const double R[AA_RESTRICT 4])
Convert a planar rotation matrix to a complex number.
AA_API void aa_tf_cv_mul(const aa_tf_cmplx c1, const aa_tf_vec2 v1, const aa_tf_cmplx c2, const aa_tf_vec2 v2, aa_tf_cmplx *c12, aa_tf_vec2 *v12)
Multiply (chain) two complex number and translation vector planar transforms.
AA_API aa_tf_cmplx aa_tf_angle2cmplx(double angle)
Convert a rotation angle to a complex number.
double _Complex aa_tf_cmplx
Typedef for C99 complex numbers.
aa_tf_cmplx aa_tf_vec2
Represent 2D vectors as complex numbers.