6

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

enter image description here

1 Answer 1

14

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
};
1
  • 1
    Specifics: 1) skew along x, relative to the y axis, 2) skew along x, relative to the z axis, 3) skew along y, relative to the x axis, 4) skew along y, relative to the z axis, 5) skew along z, relative to the x axis, 6) skew along z relative to the y axis. You can see this is the placement of the tan(a) in the matrix too, eg 1) when you multiply a vector with the matrix, the y component of the result is affected by the tan(a) -- affected by the amount of the x component of the vector. Another way to think about it is as x gets bigger, there is more skew in the y result. Sep 25, 2017 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.