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.
23 lines
531 B
23 lines
531 B
4 years ago
|
module.exports = invert
|
||
|
|
||
|
/**
|
||
|
* Calculates the inverse of a quat
|
||
|
*
|
||
|
* @param {quat} out the receiving quaternion
|
||
|
* @param {quat} a quat to calculate inverse of
|
||
|
* @returns {quat} out
|
||
|
*/
|
||
|
function invert (out, a) {
|
||
|
var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],
|
||
|
dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3,
|
||
|
invDot = dot ? 1.0 / dot : 0
|
||
|
|
||
|
// TODO: Would be faster to return [0,0,0,0] immediately if dot == 0
|
||
|
|
||
|
out[0] = -a0 * invDot
|
||
|
out[1] = -a1 * invDot
|
||
|
out[2] = -a2 * invDot
|
||
|
out[3] = a3 * invDot
|
||
|
return out
|
||
|
}
|