Function Signature |
Description |
Example |
real dotProduct(quaternion other) |
Returns the scalar real result of the dot product of this quaternion with the other quaternion |
var a = Qt.quaternion(1,2,3,4);
var b = Qt.quaternion(5,6,7,8);
var c = a.dotProduct(b);
console.log(c);
|
quaternion times(quaternion other) |
Returns the quaternion result of multiplying this quaternion with the other quaternion, which corresponds to applying both of the rotations |
var a = Qt.quaternion(1 / Math.sqrt(2), 1 / Math.sqrt(2), 0, 0);
var b = Qt.quaternion(1 / Math.sqrt(2), 0, 1 / Math.sqrt(2), 0);
var c = b.times(a);
console.log(c.toString());
|
vector3d times(vector3d vector) |
Returns the vector3d result of rotating the vector with this quaternion |
var a = Qt.quaternion(0.5,0.5,0.5,-0.5);
var b = Qt.vector3d(4,5,6);
var c = a.times(b);
console.log(c.toString());
|
quaternion times(real factor) |
Returns the quaternion result of multiplying this quaternion with the scalar factor |
var a = Qt.quaternion(1,2,3,4);
var b = 4.48;
var c = a.times(b);
console.log(c.toString());
|
quaternion plus(quaternion other) |
Returns the quaternion result of the addition of this quaternion with the other quaternion |
var a = Qt.quaternion(1,2,3,4);
var b = Qt.quaternion(5,6,7,8);
var c = a.plus(b);
console.log(c.toString());
|
quaternion minus(quaternion other) |
Returns the quaternion result of the subtraction of other quaternion from this quaternion |
var a = Qt.quaternion(1,2,3,4);
var b = Qt.quaternion(5,6,7,8);
var c = a.minus(b);
console.log(c.toString());
|
quaternion normalized() |
Returns the normalized unit form of this quaternion |
var a = Qt.quaternion(1,2,3,4);
var b = a.normalized();
console.log(b.toString());
|
quaternion inverted() |
Returns the inverse of this quaternion |
var a = Qt.quaternion(0.5,0.5,0.5,-0.5);
var b = a.inverted();
console.log(b.toString());
|
quaternion conjugated() |
Returns the conjugate of this quaternion |
var a = Qt.quaternion(1,2,3,4);
var b = a.conjugated()
console.log(b.toString());
|
real length() |
Returns the scalar real value of the length of this quaternion |
var a = Qt.quaternion(1,2,3,4);
var b = a.length();
console.log(b.toString());
|
vector3d toEulerAngles() |
Returns the vector3d Euler angles (in degrees) that corresponds to this quaternion |
var a = Qt.quaternion(0.933012,0.25,-0.25,0.066987);
var b = a.toEulerAngles();
console.log(b.toString());
|
vector4d toVector4d() |
Returns the vector4d result of converting this quaternion to a vector4d |
var a = Qt.quaternion(1,2,3,4);
var b = a.toVector4d();
console.log(b.toString());
|
bool fuzzyEquals(quaternion other, real epsilon) |
Returns true if this quaternion is approximately equal to the other quaternion. The approximation will be true if each attribute of this is within epsilon of
other . Note that epsilon is an optional argument, the default epsilon is 0.00001. |
var a = Qt.quaternion(1,2,3,4);
var b = Qt.quaternion(1.0001, 1.9998, 2.0001, 3.9999);
var c = a.fuzzyEquals(b);
var d = a.fuzzyEquals(b, 0.005);
console.log(c + " " + d);
|