mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-14 15:33:26 +00:00
added more classes
This commit is contained in:
@@ -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);
|
||||
};
|
||||
}
|
||||
18
include/omath/projectile_prediction/ProjPredEngine.hpp
Normal file
18
include/omath/projectile_prediction/ProjPredEngine.hpp
Normal 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
|
||||
26
include/omath/projectile_prediction/ProjPredEngineAVX2.hpp
Normal file
26
include/omath/projectile_prediction/ProjPredEngineAVX2.hpp
Normal 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
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
#include "omath/Vector3.hpp"
|
||||
|
||||
namespace omath::prediction
|
||||
namespace omath::projectile_prediction
|
||||
{
|
||||
class Projectile final
|
||||
{
|
||||
@@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
#include "omath/Vector3.hpp"
|
||||
|
||||
namespace omath::prediction
|
||||
namespace omath::projectile_prediction
|
||||
{
|
||||
class Target final
|
||||
{
|
||||
Reference in New Issue
Block a user