Add homogeneous scale transformation
Add function to generate homogeneous 3 dimensional scale transformation matrices.
This commit is contained in:
parent
1c6a635497
commit
253da17bc7
@ -147,6 +147,23 @@ Matrix<T> rotationMatrix(double radians, Axis axis)
|
|||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
Matrix<T> scaleMatrix(T x, T y, T z)
|
||||||
|
{
|
||||||
|
Matrix<T> matrix;
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
matrix[i].fill(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix[0][0] = x;
|
||||||
|
matrix[1][1] = y;
|
||||||
|
matrix[2][2] = z;
|
||||||
|
matrix[3][3] = 1;
|
||||||
|
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Matrix<T> translationMatrix(T x, T y, T z)
|
Matrix<T> translationMatrix(T x, T y, T z)
|
||||||
{
|
{
|
||||||
|
@ -53,6 +53,15 @@ Matrix<T> projectionMatrix(T location, Axis normal);
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
Matrix<T> rotationMatrix(T radians, Axis axis);
|
Matrix<T> rotationMatrix(T radians, Axis axis);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a 3 dimensional transformation matrix for scaling.
|
||||||
|
* @param x Scale in x-direction
|
||||||
|
* @param y Scale in y-direction
|
||||||
|
* @param z Scale in z-direction
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
Matrix<T> scaleMatrix(T x, T y, T z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a 3 dimensional transformation matrix for translation.
|
* Creates a 3 dimensional transformation matrix for translation.
|
||||||
* @param x Translation in the the x-direction.
|
* @param x Translation in the the x-direction.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user