1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 23:27:42 +00:00

AK: Add to_radians and to_degrees math functions

This commit is contained in:
Bastiaan van der Plaat 2023-09-09 14:43:39 +02:00 committed by Sam Atkins
parent 9b7aa8f6b6
commit 494a8cb816
15 changed files with 40 additions and 40 deletions

View file

@ -313,7 +313,7 @@ JS::NonnullGCPtr<DOMMatrix> DOMMatrix::skew_x_self(double sx)
{
// 1. Post-multiply a skewX transformation on the current matrix by the specified angle sx in degrees. The 2D skewX matrix is described in CSS Transforms with alpha = sx in degrees. [CSS3-TRANSFORMS]
// clang-format off
Gfx::DoubleMatrix4x4 skew_matrix = { 1, tan(sx * M_PI / 180.0), 0, 0,
Gfx::DoubleMatrix4x4 skew_matrix = { 1, tan(AK::to_radians(sx)), 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1 };
@ -330,7 +330,7 @@ JS::NonnullGCPtr<DOMMatrix> DOMMatrix::skew_y_self(double sy)
// 1. Post-multiply a skewX transformation on the current matrix by the specified angle sy in degrees. The 2D skewY matrix is described in CSS Transforms with beta = sy in degrees. [CSS3-TRANSFORMS]
// clang-format off
Gfx::DoubleMatrix4x4 skew_matrix = { 1, 0, 0, 0,
tan(sy * M_PI / 180.0), 1, 0, 0,
tan(AK::to_radians(sy)), 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1 };
// clang-format on