Go to the documentation of this file.
32 mat4(
const T& a_00,
const T& a_01,
const T& a_02,
const T& a_03,
33 const T& a_10,
const T& a_11,
const T& a_12,
const T& a_13,
34 const T& a_20,
const T& a_21,
const T& a_22,
const T& a_23,
35 const T& a_30,
const T& a_31,
const T& a_32,
const T& a_33)
45 const T& a_00,
const T& a_01,
const T& a_02,
const T& a_03,
46 const T& a_10,
const T& a_11,
const T& a_12,
const T& a_13,
47 const T& a_20,
const T& a_21,
const T& a_22,
const T& a_23,
48 const T& a_30,
const T& a_31,
const T& a_32,
const T& a_33)
61 void set_rotate(
const T& a_x,
const T& a_y,
const T& a_z,
const T& a_angle,T(*a_sin)(T),T(*a_cos)(T)) {
65 const T& a_b,
const T& a_t,
66 const T& a_n,
const T& a_f) {
68 T tx = -(a_r+a_l)/(a_r-a_l);
69 T ty = -(a_t+a_b)/(a_t-a_b);
70 T tz = -(a_f+a_n)/(a_f-a_n);
72 T a_00,a_01,a_02,a_03;
73 T a_10,a_11,a_12,a_13;
74 T a_20,a_21,a_22,a_23;
75 T a_30,a_31,a_32,a_33;
76 a_00 = 2/(a_r-a_l);a_01 = 0;a_02 = 0;a_03 = tx;
77 a_10 = 0;a_11 = 2/(a_t-a_b);a_12 = 0;a_13 = ty;
78 a_20 = 0;a_21 = 0;a_22 = -2/(a_f-a_n);a_23 = tz;
79 a_30 = 0;a_31 = 0;a_32 = 0;a_33 = 1;
98 const T& a_b,
const T& a_t,
99 const T& a_n,
const T& a_f) {
101 T A = (a_r+a_l)/(a_r-a_l);
102 T B = (a_t+a_b)/(a_t-a_b);
103 T C = -(a_f+a_n)/(a_f-a_n);
104 T D = -(2*a_f*a_n)/(a_f-a_n);
106 T a_00,a_01,a_02,a_03;
107 T a_10,a_11,a_12,a_13;
108 T a_20,a_21,a_22,a_23;
109 T a_30,a_31,a_32,a_33;
110 a_00 = (2*a_n)/(a_r-a_l);a_01 = 0;a_02 = A;a_03 = 0;
111 a_10 = 0;a_11 = (2*a_n)/(a_t-a_b);a_12 = B;a_13 = 0;
112 a_20 = 0;a_21 = 0;a_22 = C;a_23 = D;
113 a_30 = 0;a_31 = 0;a_32 = -1;a_33 = 0;
117 a_30,a_31,a_32,a_33);
168 void mul_4(T& a_x,T& a_y,T& a_z,T& a_p)
const {
184 void mul_3(T& a_x,T& a_y,T& a_z)
const {
234 void mul_scale(
const T& a_sx,
const T& a_sy,
const T& a_sz) {
279 void mul_rotate(
const T& a_x,
const T& a_y,
const T& a_z,
const T& a_angle,T(*a_sin)(T),T(*a_cos)(T)) {
282 parent::_mul_mtx(rot);
285 void left_mul_rotate(
const T& a_x,
const T& a_y,
const T& a_z,
const T& a_angle,T(*a_sin)(T),T(*a_cos)(T)) {
288 parent::_left_mul_mtx(_m);
294 parent::_left_mul_mtx(_m);
300 parent::_left_mul_mtx(_m);
345 v[0] = T(1);v[4] = 0;v[ 8] = 0;v[12] = a_x;
346 v[1] = 0;v[5] = T(1);v[ 9] = 0;v[13] = a_y;
347 v[2] = 0;v[6] = 0;v[10] = T(1);v[14] = a_z;
348 v[3] = 0;v[7] = 0;v[11] = 0;v[15] = T(1);
351 static void _set_scale(
const T& a_1,
const T& a_2,
const T& a_3,T v[]) {
352 v[0] = a_1;v[4] = 0;v[ 8] = 0;v[12] = 0;
353 v[1] = 0;v[5] = a_2;v[ 9] = 0;v[13] = 0;
354 v[2] = 0;v[6] = 0;v[10] = a_3;v[14] = 0;
355 v[3] = 0;v[7] = 0;v[11] = 0;v[15] = T(1);
358 static void _set_rotate(
const T& a_x,
const T& a_y,
const T& a_z,
const T& a_angle,T v[],T(*a_sin)(T),T(*a_cos)(T)) {
361 T si = a_sin(a_angle);
362 T co = a_cos(a_angle);
372 v[0] = x2+(1-x2)*co;v[4] = xy*(1-co)-z*si;v[ 8] = xz*(1-co)+y*si;v[12] = 0;
373 v[1] = xy*(1-co)+z*si;v[5] = y2+(1-y2)*co;v[ 9] = yz*(1-co)-x*si;v[13] = 0;
374 v[2] = xz*(1-co)-y*si;v[6] = yz*(1-co)+x*si;v[10] = z2+(1-z2)*co;v[14] = 0;
375 v[3] = 0;v[7] = 0;v[11] = 0;v[15] = 1;
395 const T& a_10,
const T& a_11,
const T& a_12,
396 const T& a_20,
const T& a_21,
const T& a_22)
441 tv[0] = tv_0*fv_0+tv_4*fv_1+ tv_8*fv_2;
442 tv[1] = tv_1*fv_0+tv_5*fv_1+ tv_9*fv_2;
443 tv[2] = tv_2*fv_0+tv_6*fv_1+tv_10*fv_2;
444 tv[3] = tv_3*fv_0+tv_7*fv_1+tv_11*fv_2;
446 tv[4] = tv_0*fv_4+tv_4*fv_5+ tv_8*fv_6;
447 tv[5] = tv_1*fv_4+tv_5*fv_5+ tv_9*fv_6;
448 tv[6] = tv_2*fv_4+tv_6*fv_5+tv_10*fv_6;
449 tv[7] = tv_3*fv_4+tv_7*fv_5+tv_11*fv_6;
451 tv[8] = tv_0*fv_8+tv_4*fv_9+ tv_8*fv_10;
452 tv[9] = tv_1*fv_8+tv_5*fv_9+ tv_9*fv_10;
453 tv[10] = tv_2*fv_8+tv_6*fv_9+tv_10*fv_10;
454 tv[11] = tv_3*fv_8+tv_7*fv_9+tv_11*fv_10;
462 template <
class MAT3>
469 private:
static void check_instantiation() {
mat4<float> dummy;}
477 template <
class T>
inline const mat4<T>&
mat4_zero() {
static const mat4<T> s_v(
false);
return s_v;}
504 const T* v = a_mtx.data();
505 a_out << v[0] <<
"," << v[4] <<
"," << v[ 8] <<
"," << v[12] << std::endl
506 << v[1] <<
"," << v[5] <<
"," << v[ 9] <<
"," << v[13] << std::endl
507 << v[2] <<
"," << v[6] <<
"," << v[10] <<
"," << v[14] << std::endl
508 << v[3] <<
"," << v[7] <<
"," << v[11] <<
"," << v[15] << std::endl;