1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

Everywhere: Use AK/Math.h if applicable

AK's version should see better inlining behaviors, than the LibM one.
We avoid mixed usage for now though.

Also clean up some stale math includes and improper floatingpoint usage.
This commit is contained in:
Hendiadyoin1 2021-07-17 18:29:28 +02:00 committed by Ali Mohammad Pur
parent c5f6ba6e71
commit ed46d52252
40 changed files with 116 additions and 156 deletions

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Math.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
@ -18,8 +19,6 @@
#include <LibGfx/Path.h>
#include <unistd.h>
#include <math.h>
class MainFrame final : public GUI::Frame {
C_OBJECT(MainFrame);
@ -100,17 +99,17 @@ public:
Gfx::IntPoint p3;
Gfx::IntPoint p4;
p1.set_x(radius * cos(M_PI * m_wheel_delta_acc / 18) + off_x);
p1.set_y(radius * sin(M_PI * m_wheel_delta_acc / 18) + off_y);
p1.set_x(radius * AK::cos(AK::Pi<double> * m_wheel_delta_acc / 18.) + off_x);
p1.set_y(radius * AK::sin(AK::Pi<double> * m_wheel_delta_acc / 18.) + off_y);
p2.set_x(radius * cos(M_PI * (m_wheel_delta_acc + 18) / 18) + off_x);
p2.set_y(radius * sin(M_PI * (m_wheel_delta_acc + 18) / 18) + off_y);
p2.set_x(radius * AK::cos(AK::Pi<double> * (m_wheel_delta_acc + 18) / 18.) + off_x);
p2.set_y(radius * AK::sin(AK::Pi<double> * (m_wheel_delta_acc + 18) / 18.) + off_y);
p3.set_x(radius * cos(M_PI * (m_wheel_delta_acc + 9) / 18) + off_x);
p3.set_y(radius * sin(M_PI * (m_wheel_delta_acc + 9) / 18) + off_y);
p3.set_x(radius * AK::cos(AK::Pi<double> * (m_wheel_delta_acc + 9) / 18.) + off_x);
p3.set_y(radius * AK::sin(AK::Pi<double> * (m_wheel_delta_acc + 9) / 18.) + off_y);
p4.set_x(radius * cos(M_PI * (m_wheel_delta_acc + 27) / 18) + off_x);
p4.set_y(radius * sin(M_PI * (m_wheel_delta_acc + 27) / 18) + off_y);
p4.set_x(radius * AK::cos(AK::Pi<double> * (m_wheel_delta_acc + 27) / 18.) + off_x);
p4.set_y(radius * AK::sin(AK::Pi<double> * (m_wheel_delta_acc + 27) / 18.) + off_y);
painter.draw_line(p1, p2, Color::Red, 2);
painter.draw_line(p3, p4, Color::Red, 2);