Skip to content

Commit

Permalink
Merge branch 'main' of github.com:X-R-G-B/B-luga
Browse files Browse the repository at this point in the history
  • Loading branch information
Saverio976 committed Nov 5, 2023
2 parents b430074 + 9a0f592 commit 968b8af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion libs/B-luga-physics/include/B-luga-physics/ECSSystems.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <functional>
#include <string>
#include <vector>
#include <numbers>
#include "B-luga/Maths/Maths.hpp"
#include "nlohmann/json.hpp"
#include "B-luga/Json.hpp"
Expand Down Expand Up @@ -290,7 +291,7 @@ namespace Systems {
// Time for the complete zigzag cycle
float period = zigzagData.period;
float WavePosY =
amplitude * std::sin(2.0F * static_cast<float>(M_PI) * elapsedTimeInMs / period);
amplitude * std::sin(2.0F * std::numbers::pi_v<float> * elapsedTimeInMs / period);
positionComp[id].y = zigzagData.originPos.y + Maths::floatToIntConservingDecimals(WavePosY);
if (positionComp[id].y < minY) {
positionComp[id].y = minY;
Expand Down
5 changes: 3 additions & 2 deletions libs/B-luga/include/B-luga/Maths/Maths.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#pragma once

#define _USE_MATH_DEFINES
#include <numbers>
#include <cmath>
#include <stdexcept>

Expand Down Expand Up @@ -210,7 +211,7 @@ class Maths {
*/
static float getAngleFromVector(const float x, const float y)
{
float angle = atan2(y, x) * 180.0F / static_cast<float>(M_PI);
float angle = atan2(y, x) * 180.0F / std::numbers::pi_v<float>;
if (angle < 0) {
angle += 360;
}
Expand All @@ -224,6 +225,6 @@ class Maths {
*/
static float degreesToRadians(const float degrees)
{
return degrees * static_cast<float>(M_PI) / 180;
return degrees * std::numbers::pi_v<float> / 180;
}
};

0 comments on commit 968b8af

Please sign in to comment.