individual methods
complete sfrotation class
This class can represent a 3D rotation. The class has 4 double numbers which
represent the rotation as either quaternion, axis-angle or euler number depending
on the cde int/enum
The class has methods to combine with other rotations. Also many other methods,
including the ability to load and save to from VRML and x3d
There are 3 versions available depending on language:
See also the following related classes
- sfvec2f
- sfvec3f
- sfrotation
- sftranslation
- sfmulti3d
The full source code is available on Sourceforge here:
Conjugate
public final void conjugate(Quat4d q1) {
x = -q1.x;
y = -q1.y;
z = -q1.z;
w = q1.w;
}
Normalising Quaternions
public final void normalise() {
double n = Math.sqrt(x*x + y*y + z*z + w*w);
x /= n;
y /= n;
z /= n;
w /= n;
}
Quaternion Scalar Multiplication
public final void scale(double s){
x *= s;
y *= s;
z *= s;
w *= s;
}