hive/html/js-graph/vjSVG_base.js
/*! Returns a function for coordinate transforms which preserves aspect ratio
 *  and (optionally) the orientation
 * \param matrix 4x4 affine transformation matrix
 */
Returns a function for coordinate transforms which preserves aspect ratio
and (optionally) the orientation
\param matrix 4x4 affine transformation matrix
Returns a function for coordinate transforms which preserves aspect ratio and ( optionally ) the orientation \ param matrix 4x4 affine transformation matrix
function vjSVGMakeAspectPreserver(matrix)
{
    var TSR = matrixAffineTSRDecompose(matrix);
    var equalized_S = matrixCopy(TSR.S); 
    var minScale = Math.min(Math.abs(equalized_S[0][0]), Math.abs(equalized_S[1][1]));
    for (var i=0; i<2; i++) {
        if (equalized_S[i][i] > 0 && equalized_S[i][i] > minScale)
            equalized_S[i][i] = minScale;
        else if (equalized_S[i][i] < 0 && equalized_S[i][i] < -minScale)
            equalized_S[i][i] = -minScale;
    }
    var equalized_SR = matrixMultiplication(equalized_S, TSR.R);
    var SR = matrixMultiplication(TSR.S, TSR.R);
    return function(center, noRotate, noScale) {
        var SRcenter = matrixMultiplicationToVector(SR, center);
        var offset_T = matrixCopy(TSR.T); 
        offset_T[0][3] += SRcenter.x;
        offset_T[1][3] += SRcenter.y;
        offset_T[2][3] += SRcenter.z;
        var C = matrixIdentity(4);
        C[0][3] = -center.x;
        C[1][3] = -center.y;
        C[2][3] = center.z ? -center.z : 0;
        var offset_SR = noScale ? C : matrixMultiplication(noRotate ? equalized_S : equalized_SR, C);
        return matrixMultiplication(offset_T, offset_SR);
    };
}
function vjSVGMakeAspectPreserver ( matrix ) { var TSR = matrixAffineTSRDecompose ( matrix ) ; var equalized_S = matrixCopy ( TSR . S ) ; var minScale = Math . min ( Math . abs ( equalized_S [ 0 ] [ 0 ] ) , Math . abs ( equalized_S [ 1 ] [ 1 ] ) ) ; for ( var i = 0 ; i < 2 ; i ++ ) { if ( equalized_S [ i ] [ i ] > 0 && equalized_S [ i ] [ i ] > minScale ) equalized_S [ i ] [ i ] = minScale ; else if ( equalized_S [ i ] [ i ] < 0 && equalized_S [ i ] [ i ] < - minScale ) equalized_S [ i ] [ i ] = - minScale ; } var equalized_SR = matrixMultiplication ( equalized_S , TSR . R ) ; var SR = matrixMultiplication ( TSR . S , TSR . R ) ; return function ( center , noRotate , noScale ) { var SRcenter = matrixMultiplicationToVector ( SR , center ) ; var offset_T = matrixCopy ( TSR . T ) ; offset_T [ 0 ] [ 3 ] += SRcenter . x ; offset_T [ 1 ] [ 3 ] += SRcenter . y ; offset_T [ 2 ] [ 3 ] += SRcenter . z ; var C = matrixIdentity ( 4 ) ; C [ 0 ] [ 3 ] = - center . x ; C [ 1 ] [ 3 ] = - center . y ; C [ 2 ] [ 3 ] = center . z ? - center . z : 0 ; var offset_SR = noScale ? C : matrixMultiplication ( noRotate ? equalized_S : equalized_SR , C ) ; return matrixMultiplication ( offset_T , offset_SR ) ; } ; }
Returns a function for coordinate transforms which preserves aspect ratio
  and (optionally) the orientation
 \param matrix 4x4 affine transformation matrix
Returns a function for coordinate transforms which preserves aspect ratio and ( optionally ) the orientation \ param matrix 4x4 affine transformation matrix
// xy-aspect equalized S /*! \param center Point (in coordinates suitable as rhs for TSR) to be used as the
                      "center" for the transform. E.g. the center of element to draw.
        \param noRotate If true, the rotation will be skipped. Note that reflection
                        may still occur, so this is suitable only for symmetric cases.
     */ // centered T