19 #include <gsl/gsl_blas.h> 41 result->
a = (-q1->
b*q2->
b-q1->
c*q2->
c -q1->
d*q2->
d);
42 result->
b = (q1->
a*q2->
b +q1->
c*q2->
d -q1->
d*q2->
c);
43 result->
c = (q1->
a*q2->
c -q1->
b*q2->
d +q1->
d*q2->
b);
44 result->
d = (q1->
a*q2->
d +q1->
b*q2->
c -q1->
c*q2->
b );
52 result->
fx = (-q1->
a*q2->
b +q1->
b*q2->
a -q1->
c*q2->
d +q1->
d*q2->
c);
53 result->
fy = (-q1->
a*q2->
c +q1->
b*q2->
d +q1->
c*q2->
a -q1->
d*q2->
b);
54 result->
fz = (-q1->
a*q2->
d -q1->
b*q2->
c +q1->
c*q2->
b +q1->
d*q2->
a);
63 pP.
fx =p[0]; pP.
fy =p[1]; pP.
fz =p[2];
64 rR.
fx =r[0]; rR.
fy =r[1]; rR.
fz =r[2];
68 p[0] = pP.
fx; p[1] =pP.
fy; p[2] = pP.
fz;
80 5.0f*sqrtf(std::numeric_limits<float>::epsilon()));
91 sincos(angle*0.5f,&sinCoeff,&cosCoeff);
97 rotQuat.
a = cos(angle);
99 rotQuat.
b=sinCoeff*rotVec->
fx;
100 rotQuat.
c=sinCoeff*rotVec->
fy;
101 rotQuat.
d=sinCoeff*rotVec->
fz;
104 pointQuat.
b = point->
fx;
105 pointQuat.
c = point->
fy;
106 pointQuat.
d = point->
fz;
116 const Point3f *rotVec,
float angle)
121 for(
size_t ui=0;ui<n;ui++)
123 fArr[ui].
fx = pointArr[ui][0];
124 fArr[ui].
fy = pointArr[ui][1];
125 fArr[ui].
fz = pointArr[ui][2];
130 for(
size_t ui=0;ui<n;ui++)
132 pointArr[ui][0]=fArr[ui].
fx;
133 pointArr[ui][1]=fArr[ui].
fy;
134 pointArr[ui][2]=fArr[ui].
fz;
140 const Point3f *rotVec,
float angle)
147 5.0f*sqrtf(std::numeric_limits<float>::epsilon()));
155 sincos(angle*0.5f,&sinCoeff,&cosCoeff);
161 rotQuat.
a = cos(angle);
163 rotQuat.
b=sinCoeff*rotVec->
fx;
164 rotQuat.
c=sinCoeff*rotVec->
fy;
165 rotQuat.
d=sinCoeff*rotVec->
fz;
167 for(
unsigned int ui=0;ui<n; ui++)
170 pointQuat.
b = pointArr[ui].
fx;
171 pointQuat.
c = pointArr[ui].
fy;
172 pointQuat.
d = pointArr[ui].
fz;
187 5.0f*sqrtf(std::numeric_limits<float>::epsilon()));
192 sincos(angle*0.5f,&sinCoeff,&cosCoeff);
197 rotQuat->
a = cos(angle);
200 rotQuat->
b=sinCoeff*rotVec->
fx;
201 rotQuat->
c=sinCoeff*rotVec->
fy;
202 rotQuat->
d=sinCoeff*rotVec->
fz;
210 pointQuat.
b = point->
fx;
211 pointQuat.
c = point->
fy;
212 pointQuat.
d = point->
fz;
void quat_mult_no_second_a(Quaternion *result, const Quaternion *q1, const Quaternion *q2)
void quat_get_rot_quat(const Point3f *rotVec, float angle, Quaternion *rotQuat)
Compute the quaternion for specified rotation.
void quat_rot_apply_quat(Point3f *point, const Quaternion *rotQuat)
Use previously generated quats from quat_get_rot_quats to rotate a point.
void quat_pointmult(Point3f *result, const Quaternion *q1, const Quaternion *q2)
A 3D point data class storage.
Data storage structure for points.
Data storage structure for quaternions.
void quat_rot(Point3D &p, const Point3D &r, float angle)
Rotate a point around a given rotation axis by a specified angle.
void quat_rot_array(Point3f *point, unsigned int n, const Point3f *rotVec, float angle)
Rotate each point in array of size n around a given vector, with specified angle. ...
void quat_invert(Quaternion *quat)