2 * $Source: x:/prj/tech/libsrc/matrix/RCS/matvec.c $
5 * $Date: 1997/11/20 13:32:02 $
12 // element wise mul of m by v to make different coordinate
15 void mxd_mat_elmul_vec(mxds_matrix
*dest
,const mxds_matrix
*m
,const mxds_vector
*v
)
17 dest
->el
[0] = m
->el
[0] * v
->x
;
18 dest
->el
[1] = m
->el
[1] * v
->x
;
19 dest
->el
[2] = m
->el
[2] * v
->x
;
21 dest
->el
[3] = m
->el
[3] * v
->y
;
22 dest
->el
[4] = m
->el
[4] * v
->y
;
23 dest
->el
[5] = m
->el
[5] * v
->y
;
25 dest
->el
[6] = m
->el
[6] * v
->z
;
26 dest
->el
[7] = m
->el
[7] * v
->z
;
27 dest
->el
[8] = m
->el
[8] * v
->z
;
31 void mxd_mat_elmuleq_vec(mxds_matrix
*m
,const mxds_vector
*v
)
47 void mxd_mat_eltmul_vec(mxds_matrix
*dest
,const mxds_matrix
*m
,const mxds_vector
*v
)
49 dest
->el
[0] = m
->el
[0] * v
->x
;
50 dest
->el
[3] = m
->el
[3] * v
->x
;
51 dest
->el
[6] = m
->el
[6] * v
->x
;
53 dest
->el
[1] = m
->el
[1] * v
->y
;
54 dest
->el
[4] = m
->el
[4] * v
->y
;
55 dest
->el
[7] = m
->el
[7] * v
->y
;
57 dest
->el
[2] = m
->el
[2] * v
->z
;
58 dest
->el
[5] = m
->el
[5] * v
->z
;
59 dest
->el
[8] = m
->el
[8] * v
->z
;
63 void mxd_mat_eltmuleq_vec(mxds_matrix
*m
,const mxds_vector
*v
)
79 void mxd_mat_mul_vec(mxds_vector
*dest
,const mxds_matrix
*m
,const mxds_vector
*v
)
81 dest
->x
= m
->el
[0]*v
->x
+ m
->el
[3]*v
->y
+ m
->el
[6]*v
->z
;
82 dest
->y
= m
->el
[1]*v
->x
+ m
->el
[4]*v
->y
+ m
->el
[7]*v
->z
;
83 dest
->z
= m
->el
[2]*v
->x
+ m
->el
[5]*v
->y
+ m
->el
[8]*v
->z
;
86 // v x= M, this is idiotic
87 void mxd_mat_muleq_vec(const mxds_matrix
*m
,mxds_vector
*v
)
90 mxd_mat_mul_vec(&t
,m
,v
);
94 // dest = M^t x v, this is for multing by inverse if unit
95 void mxd_mat_tmul_vec(mxds_vector
*dest
,const mxds_matrix
*m
, const mxds_vector
*v
)
97 dest
->x
= m
->el
[0]*v
->x
+ m
->el
[1]*v
->y
+ m
->el
[2]*v
->z
;
98 dest
->y
= m
->el
[3]*v
->x
+ m
->el
[4]*v
->y
+ m
->el
[5]*v
->z
;
99 dest
->z
= m
->el
[6]*v
->x
+ m
->el
[7]*v
->y
+ m
->el
[8]*v
->z
;
102 // v x= M^t, retarded
103 void mxd_mat_tmuleq_vec(const mxds_matrix
*m
,mxds_vector
*v
)
106 mxd_mat_tmul_vec(&t
,m
,v
);