18 #ifndef __QUATERNION_H 19 #define __QUATERNION_H 83 return ((a.
r==b.
r)&&(a.
i==b.
i)&&(a.
j==b.
j)&&(a.
k=b.
k));
95 for (
int i=1;
i<b;
i++) r=
qmul(r,a);
101 return sqrt(a.
r*a.
r+a.
i*a.
i+a.
j*a.
j+a.
k*a.
k);
189 if (c.
i>0) printf(
"+%fi",c.
i);
190 if (c.
i<0) printf(
"%fi",c.
i);
191 if (c.
j>0) printf(
"+%fi",c.
j);
192 if (c.
j<0) printf(
"%fi",c.
j);
193 if (c.
k>0) printf(
"+%fi",c.
k);
194 if (c.
k<0) printf(
"%fi",c.
k);
quaternion qscale(double s, quaternion a)
quaternion qmul(quaternion a, quaternion b)
quaternion qabs(quaternion a)
quaternion qsub(quaternion a, quaternion b)
void qprint(quaternion c)
quaternion qadd(quaternion a, quaternion b)
quaternion qconj(quaternion a)
quaternion qneg(quaternion a)
quaternion qpos(quaternion a)
quaternion qNormalize(quaternion q)
bool isEqualE(quaternion a, quaternion b)
void rotate(double *x, double *y, double *z, quaternion q)
quaternion cpow(quaternion a, int b)
bool isEqual(quaternion a, quaternion b)
bool isReal(quaternion x)
quaternion qinv(quaternion a)