Search code examples
matrixangleskew

3D skew transformation matrix along one coordinate axis


Is there a way to calculate the skew transformation matrix along one coordinate axis, given the skew angle, as follows

enter image description here


Solution

  • This should work for the most part for skewing an object with a transformation matrix, in particular using glMultMatrix(matrix)

    enter image description here

    matrix1[] = {
    1,  0,  0,  0,
    tan(a), 1,  0,  0,
    0,  0,  1,  0,
    0,  0,  0,  1
    };
    
    matrix2[] = {
        1,  0,  0,  0,
        0,  1,  0,  0,
        tan(a), 0,  1,  0,
        0,  0,  0,  1
    };
    
    matrix3[] = {
        1,  tan(a), 0,  0,
        0,  1,  0,  0,
        0,  0,  1,  0,
        0,  0,  0,  1
    };
    
    matrix4[] = {
        1,  0,  0,  0,
        0,  1,  0,  0,
        0,  tan(a), 1,  0,
        0,  0,  0,  1
    };
    
    matrix5[] = {
        1,  0,  tan(a), 0,
        0,  1,  0,  0,
        0,  0,  1,  0,
        0,  0,  0,  1
    };
    
    matrix6[] = {
        1,  0,  0,  0,
        0,  1,  tan(a), 0,
        0,  0,  1,  0,
        0,  0,  0,  1
    };