added more classes

This commit is contained in:
2025-02-23 09:57:29 +03:00
parent d9684ff73f
commit 28a35d5bc9
13 changed files with 213 additions and 26 deletions

View File

@@ -6,10 +6,10 @@
#include <optional>
#include "omath/Vector3.hpp"
#include "omath/prediction/Projectile.hpp"
#include "omath/prediction/Target.hpp"
#include "omath/projectile_prediction/Projectile.hpp"
#include "omath/projectile_prediction/Target.hpp"
namespace omath::prediction
namespace omath::projectile_prediction
{
class Engine final
{
@@ -26,15 +26,8 @@ namespace omath::prediction
const float m_maximumSimulationTime;
const float m_distanceTolerance;
[[nodiscard]]
std::optional<float> MaybeCalculateProjectileLaunchPitchAngle(const Projectile& projectile,
const Vector3& targetPosition) const;
[[nodiscard]] static std::optional<float> CalculatePitch(const Vector3 &projOrigin, const Vector3 &targetPos,
float bulletGravity, float v0, float time) ;
[[nodiscard]]
bool IsProjectileReachedTarget(const Vector3& targetPosition, const Projectile& projectile, float pitch, float time) const;
float bulletGravity, float v0, float time);
};
}

View File

@@ -0,0 +1,18 @@
//
// Created by Vlad on 2/23/2025.
//
#pragma once
#include "omath/Vector3.hpp"
namespace omath::projectile_prediction
{
class ProjPredEngine
{
public:
[[nodiscard]]
virtual std::optional<Vector3> MaybeCalculateAimPoint(const Projectile& projectile,
const Target& target) const = 0;
virtual ~ProjPredEngine() = default;
};
} // namespace omath::projectile_prediction

View File

@@ -0,0 +1,26 @@
//
// Created by Vlad on 2/23/2025.
//
#pragma once
#include "ProjPredEngine.hpp"
namespace omath::projectile_prediction
{
class ProjPredEngineAVX2 final : public ProjPredEngine
{
public:
[[nodiscard]] std::optional<Vector3> MaybeCalculateAimPoint(const Projectile& projectile,
const Target& target) const override;
ProjPredEngineAVX2(float gravityConstant, float simulationTimeStep, float maximumSimulationTime);
~ProjPredEngineAVX2() override = default;
private:
[[nodiscard]] static std::optional<float> CalculatePitch(const Vector3& projOrigin, const Vector3& targetPos,
float bulletGravity, float v0, float time);
const float m_gravityConstant;
const float m_simulationTimeStep;
const float m_maximumSimulationTime;
};
} // namespace omath::projectile_prediction

View File

@@ -5,7 +5,7 @@
#pragma once
#include "omath/Vector3.hpp"
namespace omath::prediction
namespace omath::projectile_prediction
{
class Projectile final
{

View File

@@ -5,7 +5,7 @@
#pragma once
#include "omath/Vector3.hpp"
namespace omath::prediction
namespace omath::projectile_prediction
{
class Target final
{