mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 05:54:58 +00:00
LibGfx: Add Gfx::extract_2d_affine_transform(Matrix4x4) helper
This commit is contained in:
parent
da00a5cdb5
commit
848b0d9c81
1 changed files with 8 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Math.h>
|
||||
#include <LibGfx/AffineTransform.h>
|
||||
#include <LibGfx/Matrix.h>
|
||||
#include <LibGfx/Vector3.h>
|
||||
#include <LibGfx/Vector4.h>
|
||||
|
@ -76,6 +77,13 @@ constexpr static Matrix4x4<T> rotation_matrix(Vector3<T> const& axis, T angle)
|
|||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Gfx::AffineTransform extract_2d_affine_transform(Matrix4x4<T> const& matrix)
|
||||
{
|
||||
auto* m = matrix.elements();
|
||||
return Gfx::AffineTransform(m[0][0], m[1][0], m[0][1], m[1][1], m[0][3], m[1][3]);
|
||||
}
|
||||
|
||||
typedef Matrix4x4<float> FloatMatrix4x4;
|
||||
typedef Matrix4x4<double> DoubleMatrix4x4;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue