Is there a way to calculate the skew transformation matrix along one coordinate axis, given the skew angle, as follows
1 Answer
This should work for the most part for skewing an object with a transformation matrix, in particular using glMultMatrix(matrix)
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
};
-
1Specifics: 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 thetan(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