src/kinetics.js
function extractVerticalComponent(accelerometerData, attitudeData) {
        var res=[];
        var rm;
        for (var i=0;i<accelerometerData.length;i++){
            rm=new Matrix(module.exports.composeRotation(attitudeData[i][0],attitudeData[i][1],0)); 
            res[i]=new Matrix([accelerometerData[i][0],accelerometerData[i][1],accelerometerData[i][2]]).dot(rm).data[0][2];
        }
        return res;
    }
function extractVerticalComponent(accelerometerData, attitudeData) {
        var res=[];
        var rm;
        for (var i=0;i<accelerometerData.length;i++){
            rm=new Matrix(module.exports.composeRotation(attitudeData[i][0],attitudeData[i][1],0)); 
            res[i]=new Matrix([accelerometerData[i][0],accelerometerData[i][1],accelerometerData[i][2]]).dot(rm).data[0][2];
        }
        return res;
    }
function extractVerticalComponent ( accelerometerData , attitudeData ) { var res = [ ] ; var rm ; for ( var i = 0 ; i < accelerometerData . length ; i ++ ) { rm = new Matrix ( module . exports . composeRotation ( attitudeData [ i ] [ 0 ] , attitudeData [ i ] [ 1 ] , 0 ) ) ; res [ i ] = new Matrix ( [ accelerometerData [ i ] [ 0 ] , accelerometerData [ i ] [ 1 ] , accelerometerData [ i ] [ 2 ] ] ) . dot ( rm ) . data [ 0 ] [ 2 ] ; } return res ; }
Rotate accelerometer signal using attitude data and extract vertical component.
Useful for instance for implementing a pedometer

@param {2D array} (linear) accelerometerData 2D array containing time series of acceleration values [[x1, y1, z1],[x2, y2, z2],...]
@param {2D array} attitudeData 2D array containing time series of attitude values [[pitch1, roll1, yaw1]. [pitch2, roll2, yaw2],... ] (in Radians)
@returns {1D array} of vertical acceleration values [z1, z2,...]
Rotate accelerometer signal using attitude data and extract vertical component . Useful for instance for implementing a pedometer