| ax ay az aw | |-ax*(bz*cw - cz*bw) + az*(bx*cw - cx*bw) - aw*(bx*cz - cx*bz) |
| bx by bz bw | = | ax*(by*cw - cy*bw) - ay*(bx*cw - cx*bw) + aw*(bx*cy - cx*by) |
| cx cy cz cw | |-ax*(by*cz - cy*bz) + ay*(bx*cz - cx*bz) - az*(bx*cy - cx*by) |
/*Your real-number data-type*/ /*typedef float tR;*/ /*typedef tRX4 tR;*/ /*From my previous post on fixed-point data-type*/ /*tR04 is a 4D vector (of ABCD axes); Implementation is trivial*/ static tR04 xMlX(tR04 const&a,tR04 const&b,tR04 const&c)rK{ tR lbxcy(b.A()*c.B()),lcxby(c.A()*b.B()),lbycz(b.B()*c.C()),lcybz(c.B()*b.C()), lbzcx(b.C()*c.A()),lczbx(c.C()*b.A()),lbzcw(b.C()*c.D()),lczbw(c.C()*b.D()), lbwcx(b.D()*c.A()),lcwbx(c.D()*b.A()),lbwcy(b.D()*c.B()),lcwby(c.D()*b.B()); tR lbxcyNcxby(lbxcy-lcxby),lbyczNcybz(lbycz-lcybz),lbzcxNczbx(lbzcx-lczbx), lbzcwNczbw(lbzcw-lczbw),lbwcxNcwbx(lbwcx-lcwbx),lbwcyNcwby(lbwcy-lcwby); return tR04( a.B()*lbzcwNczbw+a.C()*lbwcyNcwby+a.D()*lbyczNcybz, a.D()*lbzcxNczbx-a.A()*lbzcwNczbw-a.C()*lbwcxNcwbx, a.D()*lbxcyNcxby-a.A()*lbwcyNcwby+a.B()*lbwcxNcwbx, a.B()*lbzcxNczbx-a.A()*lbyczNcybz-a.C()*lbxcyNcxby);}
No comments:
Post a Comment