3D skew transformation matrix along one coordinate axis
Asked Answered
L

1

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

Lenard answered 3/11, 2012 at 5:20 Comment(0)
L
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
};
Lenard answered 3/11, 2012 at 16:50 Comment(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.Liederkranz

© 2022 - 2024 — McMap. All rights reserved.