Difference between revisions of "Float Quaternion Multiply"

From OpenLuna
Jump to: navigation, search
(New page: <nowiki> #include <math.h> int qdotq(float *p,float *q, float *r) /* product (r) of qutonians p and q */ - 0 = real, 1=i, 2=j, 3=k: /* ges 042709 *...)

Revision as of 15:39, 29 April 2009

#include <math.h> int qdotq(float *p,float *q, float *r) /* product (r) of qutonians p and q */ /* 0 = real, 1=i, 2=j, 3=k */ /* ges 042709 */ { r[0]=p[0]*q[0]-p[1]*q[1]-p[2]*q[2]-p[3]*q[3]; r[1]=p[1]*q[0]+p[0]*q[1]-p[3]*q[2]+p[2]*q[3]; r[2]=p[2]*q[0]+p[3]*q[1]+p[0]*q[2]-p[1]*q[3]; r[3]=p[3]*q[0]-p[2]*q[1]+p[1]*q[2]+p[0]*q[3]; } /* End qdotq */

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox