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.
60 lines
1.6 KiB
60 lines
1.6 KiB
/*
|
|
Input: translation ; a 3 component vector
|
|
scale ; a 3 component vector
|
|
skew ; skew factors XY,XZ,YZ represented as a 3 component vector
|
|
perspective ; a 4 component vector
|
|
quaternion ; a 4 component vector
|
|
Output: matrix ; a 4x4 matrix
|
|
|
|
From: http://www.w3.org/TR/css3-transforms/#recomposing-to-a-3d-matrix
|
|
*/
|
|
|
|
var mat4 = {
|
|
identity: require('gl-mat4/identity'),
|
|
translate: require('gl-mat4/translate'),
|
|
multiply: require('gl-mat4/multiply'),
|
|
create: require('gl-mat4/create'),
|
|
scale: require('gl-mat4/scale'),
|
|
fromRotationTranslation: require('gl-mat4/fromRotationTranslation')
|
|
}
|
|
|
|
var rotationMatrix = mat4.create()
|
|
var temp = mat4.create()
|
|
|
|
module.exports = function recomposeMat4(matrix, translation, scale, skew, perspective, quaternion) {
|
|
mat4.identity(matrix)
|
|
|
|
//apply translation & rotation
|
|
mat4.fromRotationTranslation(matrix, quaternion, translation)
|
|
|
|
//apply perspective
|
|
matrix[3] = perspective[0]
|
|
matrix[7] = perspective[1]
|
|
matrix[11] = perspective[2]
|
|
matrix[15] = perspective[3]
|
|
|
|
// apply skew
|
|
// temp is a identity 4x4 matrix initially
|
|
mat4.identity(temp)
|
|
|
|
if (skew[2] !== 0) {
|
|
temp[9] = skew[2]
|
|
mat4.multiply(matrix, matrix, temp)
|
|
}
|
|
|
|
if (skew[1] !== 0) {
|
|
temp[9] = 0
|
|
temp[8] = skew[1]
|
|
mat4.multiply(matrix, matrix, temp)
|
|
}
|
|
|
|
if (skew[0] !== 0) {
|
|
temp[8] = 0
|
|
temp[4] = skew[0]
|
|
mat4.multiply(matrix, matrix, temp)
|
|
}
|
|
|
|
//apply scale
|
|
mat4.scale(matrix, matrix, scale)
|
|
return matrix
|
|
} |