diff --git a/AK/ExtraMathConstants.h b/AK/ExtraMathConstants.h deleted file mode 100644 index 907306f45c..0000000000 --- a/AK/ExtraMathConstants.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2021, the SerenityOS developers. - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#define M_TAU 6.28318530717958647692 -#define M_DEG2RAD 0.01745329251994329576 -#define M_RAD2DEG 57.2957795130823208767 diff --git a/Meta/gn/secondary/AK/BUILD.gn b/Meta/gn/secondary/AK/BUILD.gn index 352428abd0..83b3ddf294 100644 --- a/Meta/gn/secondary/AK/BUILD.gn +++ b/Meta/gn/secondary/AK/BUILD.gn @@ -58,7 +58,6 @@ source_set("AK") { "Endian.h", "EnumBits.h", "Error.h", - "ExtraMathConstants.h", "FPControl.h", "Find.h", "FixedArray.h", diff --git a/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp b/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp index 12cd188891..4c88cc6043 100644 --- a/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp +++ b/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp @@ -7,7 +7,6 @@ #include "FastBoxBlur.h" #include "../FilterParams.h" -#include #include #include #include @@ -20,8 +19,8 @@ void FastBoxBlur::apply(Gfx::Bitmap& target_bitmap) const if (m_use_asymmetric_radii) { if (m_use_vector) { - auto radius_x = m_radius * fabs(cos((double)m_angle * M_DEG2RAD)); - auto radius_y = m_radius * fabs(sin((double)m_angle * M_DEG2RAD)); + auto radius_x = m_radius * fabs(cos(AK::to_radians(static_cast(m_angle)))); + auto radius_y = m_radius * fabs(sin(AK::to_radians(static_cast(m_angle)))); filter.apply_single_pass(radius_x, radius_y); return; } diff --git a/Userland/Libraries/LibC/math.cpp b/Userland/Libraries/LibC/math.cpp index b0031584d9..7ca54df42f 100644 --- a/Userland/Libraries/LibC/math.cpp +++ b/Userland/Libraries/LibC/math.cpp @@ -8,7 +8,6 @@ */ #include -#include #include #if !ARCH(AARCH64) # include @@ -569,7 +568,7 @@ float ldexpf(float x, int exp) NOEXCEPT [[maybe_unused]] static long double ampsin(long double angle) NOEXCEPT { - long double looped_angle = fmodl(M_PI + angle, M_TAU) - M_PI; + long double looped_angle = fmodl(M_PI + angle, M_PI * 2) - M_PI; long double looped_angle_squared = looped_angle * looped_angle; long double quadratic_term; diff --git a/Userland/Libraries/LibWeb/HTML/Canvas/CanvasPath.cpp b/Userland/Libraries/LibWeb/HTML/Canvas/CanvasPath.cpp index 9c46fac494..2e587d2f05 100644 --- a/Userland/Libraries/LibWeb/HTML/Canvas/CanvasPath.cpp +++ b/Userland/Libraries/LibWeb/HTML/Canvas/CanvasPath.cpp @@ -5,7 +5,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include namespace Web::HTML { @@ -60,7 +59,7 @@ WebIDL::ExceptionOr CanvasPath::ellipse(float x, float y, float radius_x, if (radius_y < 0) return WebIDL::IndexSizeError::create(m_self->realm(), MUST(String::formatted("The minor-axis radius provided ({}) is negative.", radius_y))); - if (constexpr float tau = M_TAU; (!counter_clockwise && (end_angle - start_angle) >= tau) + if (constexpr float tau = M_PI * 2; (!counter_clockwise && (end_angle - start_angle) >= tau) || (counter_clockwise && (start_angle - end_angle) >= tau)) { start_angle = 0; // FIXME: elliptical_arc_to() incorrectly handles the case where the start/end points are very close. diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index e8fd471ff0..a4d52545a7 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -6,7 +6,6 @@ */ #include -#include #include #include #include diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index dfdafd22fb..e0234f31d5 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -5,7 +5,6 @@ */ #include -#include #include #include #include @@ -162,7 +161,7 @@ Gfx::Path path_from_path_instructions(ReadonlySpan instructions case PathInstructionType::EllipticalArc: { double rx = data[0]; double ry = data[1]; - double x_axis_rotation = double { data[2] } * M_DEG2RAD; + double x_axis_rotation = AK::to_radians(static_cast(data[2])); double large_arc_flag = data[3]; double sweep_flag = data[4];