Optibits
Loading...
Searching...
No Matches
Math.hpp
1#pragma once
2
3#include <numbers>
4
5namespace Optibits
6{
7
12 double random(double min, double max);
13
14 inline double degreesToRadians(double angle)
15 {
16 return angle * std::numbers::pi / 180;
17 }
18
19 inline double radiansToDegrees(double angle)
20 {
21 return angle * 180 / std::numbers::pi;
22 }
23
24 inline double radiansToAngle(double angle)
25 {
26 return radiansToAngle(angle) + 90;
27 }
28
29 inline double angleToRadians(double angle)
30 {
31 return degreesToRadians(angle - 90);
32 }
33
34 double offsetX(double angle, double radius);
35
36 double offsetY(double angle, double radius);
37
38 double angle(double fromX, double fromY, double toX, double toY, double fallback = 0);
39
40 double angleDiff(double angle1, double angle2);
41
42 double normalizeAngle(double angle);
43
44 int wrap(int value, int min, int max);
45 double wrap(double value, double min, double max);
46
47 double distance(double x1, double y1, double x2, double y2);
48}