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.
44 lines
1.2 KiB
44 lines
1.2 KiB
module.exports = forEach;
|
|
|
|
var vec = require('./create')()
|
|
|
|
/**
|
|
* Perform some operation over an array of vec3s.
|
|
*
|
|
* @param {Array} a the array of vectors to iterate over
|
|
* @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
|
|
* @param {Number} offset Number of elements to skip at the beginning of the array
|
|
* @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
|
|
* @param {Function} fn Function to call for each vector in the array
|
|
* @param {Object} [arg] additional argument to pass to fn
|
|
* @returns {Array} a
|
|
* @function
|
|
*/
|
|
function forEach(a, stride, offset, count, fn, arg) {
|
|
var i, l
|
|
if(!stride) {
|
|
stride = 3
|
|
}
|
|
|
|
if(!offset) {
|
|
offset = 0
|
|
}
|
|
|
|
if(count) {
|
|
l = Math.min((count * stride) + offset, a.length)
|
|
} else {
|
|
l = a.length
|
|
}
|
|
|
|
for(i = offset; i < l; i += stride) {
|
|
vec[0] = a[i]
|
|
vec[1] = a[i+1]
|
|
vec[2] = a[i+2]
|
|
fn(vec, vec, arg)
|
|
a[i] = vec[0]
|
|
a[i+1] = vec[1]
|
|
a[i+2] = vec[2]
|
|
}
|
|
|
|
return a
|
|
} |