00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef __RPP_VECMAT_H__
00042 #define __RPP_VECMAT_H__
00043
00044 #include "rpp_const.h"
00045 #include "rpp_types.h"
00046
00047 namespace rpp {
00048
00049 real_t _sin(real_t a);
00050 real_t _cos(real_t a);
00051 real_t _atan2(real_t a, real_t b);
00052 real_t _abs(real_t a);
00053 real_t _acos(real_t a);
00054 real_t _sqrt(real_t a);
00055 real_t _pow(real_t a);
00056
00057 void mat33_from_double_pptr(mat33_t &mat, double** m_ptr);
00058 double ** mat33_to_double_pptr(const mat33_t &mat);
00059 void free_double_pptr(double*** m_ptr);
00060 void vec3_from_double_ptr(vec3_t &vec, double* v_ptr);
00061 double* vec3_to_double_ptr(const vec3_t &vec);
00062 void free_double_ptr(double** v_ptr);
00063 void mat33_assign(mat33_t &m,
00064 const real_t m00, const real_t m01, const real_t m02,
00065 const real_t m10, const real_t m11, const real_t m12,
00066 const real_t m20, const real_t m21, const real_t m22);
00067 void _dbg_quat_print(const quat_t &q, char* name);
00068 void _dbg_mat33_print(const mat33_t &m, char* name);
00069 void _dbg_mat33_array_print(const mat33_array &m, char* name);
00070 void _dbg_vec3_print(const vec3_t &v, char* name);
00071 void _dbg_vec3_array_print(const vec3_array &v, char* name);
00072 bool _dbg_load_vec3_array(vec3_array &va, char* filename);
00073 void vec3_assign(vec3_t &v, const real_t x, const real_t y, const real_t z);
00074 void vec3_clear(vec3_t &v);
00075 void vec3_copy(vec3_t &a, const vec3_t &b);
00076 void vec3_array_sum(vec3_t &v_sum2, const vec3_array &va);
00077 void vec3_array_sum(scalar_array &v_sum1, const vec3_array &va);
00078 void vec3_array_pow2(vec3_array &va);
00079 void vec3_div(vec3_t &va, const real_t n);
00080 void vec3_div(vec3_t &va, const vec3_t &vb);
00081 void vec3_mult(vec3_t &va, const real_t n);
00082 void vec3_mult(vec3_t &va, const vec3_t &vb);
00083 void vec3_add(vec3_t &va, const real_t f);
00084 void vec3_add(vec3_t &va, const vec3_t &vb);
00085 void vec3_add(vec3_t &va, const vec3_t &vb, const vec3_t &vc);
00086 void vec3_sub(vec3_t &va, const real_t f);
00087 void vec3_sub(vec3_t &va, const vec3_t &vb);
00088 void vec3_sub(vec3_t &va, const vec3_t &vb, const vec3_t &vc);
00089 real_t vec3_dot(const vec3_t &va, const vec3_t &vb);
00090 void vec3_cross(vec3_t &va, const vec3_t &vb, const vec3_t &vc);
00091 real_t vec3_norm(const vec3_t &v);
00092 real_t vec3_sum(const vec3_t &v);
00093 void vec3_array_add(vec3_array &va, const vec3_t &a);
00094 void vec3_array_sub(vec3_array &va, const vec3_t &a);
00095 void vec3_array_set(vec3_array &va, const vec3_t &a, const bool mask[3]);
00096 void vec3_array_mult(vec3_array &va, const scalar_array &c);
00097 void vec3_array_mean(vec3_t &v_mean, const vec3_array &va);
00098 void vec3_mul_vec3trans(mat33_t &m, const vec3_t &va, const vec3_t &vb);
00099 real_t vec3trans_mul_vec3(const vec3_t &va, const vec3_t &vb);
00100 void mat33_clear(mat33_t &m);
00101 void mat33_copy(mat33_t &md, const mat33_t &ms);
00102 void mat33_to_col_vec3(vec3_t &c0, vec3_t &c1, vec3_t &c2, const mat33_t &m);
00103 void mat33_div(mat33_t &m, const real_t f);
00104 void mat33_eye(mat33_t &m);
00105 real_t mat33_sum(const mat33_t &m);
00106 bool mat33_all_zeros(const mat33_t &m);
00107 void mat33_set_all_zeros(mat33_t &m);
00108 void mat33_array_sum(mat33_t &s, const mat33_array &ma);
00109 void mat33_sub(mat33_t &mr, const mat33_t &ma, const mat33_t &mb);
00110 void mat33_sub(mat33_t &ma, const mat33_t &mb);
00111 void mat33_add(mat33_t &mr, const mat33_t &ma, const mat33_t &mb);
00112 void mat33_add(mat33_t &ma, const mat33_t &mb);
00113 real_t mat33_det(const mat33_t &a);
00114 void mat33_inv(mat33_t &mi, const mat33_t &ma);
00115 void mat33_mult(mat33_t &m0, const mat33_t &m1, const mat33_t &m2);
00116 void mat33_mult(mat33_t &mr, const real_t n);
00117 void mat33_transpose(mat33_t &t, const mat33_t m);
00118 void vec3_mult(vec3_t &v0, const mat33_t &m1, const vec3_t &v2);
00119 void vec3_array_mult(vec3_array &va, const mat33_t &m, const vec3_array &vb);
00120 void mat33_svd2(mat33_t &u, mat33_t &s, mat33_t &v, const mat33_t &m);
00121 void quat_mult(quat_t &q, const real_t s);
00122 real_t quat_norm(const quat_t &q);
00123 void mat33_from_quat(mat33_t &m, const quat_t &q);
00124 void normRv(vec3_t &n, const vec3_t &v);
00125 void normRv(vec3_array &normR_v, const vec3_array &v);
00126
00127 int solve_polynomial(scalar_array &sol, const scalar_array &coefficients);
00128 void scalar_array_pow(scalar_array &sa, const real_t f);
00129 void scalar_array_negate(scalar_array &sa);
00130 void scalar_array_assign(scalar_array &sa,
00131 const real_t f,
00132 const unsigned int sz);
00133 void scalar_array_add(scalar_array &sa, const scalar_array &sb);
00134 void scalar_array_clear(scalar_array &sa);
00135 void scalar_array_atan2(scalar_array &sa,
00136 const scalar_array &sb,
00137 const scalar_array &sc);
00138
00139 void _dbg_scalar_array_print(const scalar_array &sa, char* name);
00140 void scalar_array_div(scalar_array &sa, real_t f);
00141 void scalar_array_div(scalar_array &sa, const scalar_array &sb);
00142 void scalar_array_mult(scalar_array &sa, real_t f);
00143 void scalar_array_add(scalar_array &sa, real_t f);
00144 void scalar_array_sub(scalar_array &sa, real_t f);
00145 void mat33_pow2(mat33_t &m);
00146
00147 void _dbg_vec3_fprint(void* fp, const vec3_t &v, char* name);
00148 void _dbg_mat33_fprint(void* fp, const mat33_t &m, char* name);
00149
00150 }
00151
00152 #endif