StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
749 B
27 lines
749 B
module.exports = transformQuat
|
|
|
|
/**
|
|
* Transforms the vec4 with a quat
|
|
*
|
|
* @param {vec4} out the receiving vector
|
|
* @param {vec4} a the vector to transform
|
|
* @param {quat} q quaternion to transform with
|
|
* @returns {vec4} out
|
|
*/
|
|
function transformQuat (out, a, q) {
|
|
var x = a[0], y = a[1], z = a[2],
|
|
qx = q[0], qy = q[1], qz = q[2], qw = q[3],
|
|
|
|
// calculate quat * vec
|
|
ix = qw * x + qy * z - qz * y,
|
|
iy = qw * y + qz * x - qx * z,
|
|
iz = qw * z + qx * y - qy * x,
|
|
iw = -qx * x - qy * y - qz * z
|
|
|
|
// calculate result * inverse quat
|
|
out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy
|
|
out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz
|
|
out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx
|
|
out[3] = a[3]
|
|
return out
|
|
}
|
|
|