mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 15:03:27 +00:00
added legacy impl
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// Created by Vlad on 6/9/2024.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include "omath/Vector3.hpp"
|
||||
#include "omath/projectile_prediction/Projectile.hpp"
|
||||
#include "omath/projectile_prediction/Target.hpp"
|
||||
|
||||
namespace omath::projectile_prediction
|
||||
{
|
||||
class Engine final
|
||||
{
|
||||
public:
|
||||
explicit Engine(float gravityConstant, float simulationTimeStep,
|
||||
float maximumSimulationTime, float distanceTolerance);
|
||||
|
||||
[[nodiscard]]
|
||||
std::optional<Vector3> MaybeCalculateAimPoint(const Projectile& projectile, const Target& target) const;
|
||||
|
||||
private:
|
||||
const float m_gravityConstant;
|
||||
const float m_simulationTimeStep;
|
||||
const float m_maximumSimulationTime;
|
||||
const float m_distanceTolerance;
|
||||
|
||||
|
||||
[[nodiscard]] static std::optional<float> CalculatePitch(const Vector3 &projOrigin, const Vector3 &targetPos,
|
||||
float bulletGravity, float v0, float time);
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
// Created by Vlad on 2/23/2025.
|
||||
//
|
||||
#pragma once
|
||||
#include "Projectile.hpp"
|
||||
#include "Target.hpp"
|
||||
#include "omath/Vector3.hpp"
|
||||
|
||||
|
||||
|
||||
41
include/omath/projectile_prediction/ProjPredEngineLegacy.hpp
Normal file
41
include/omath/projectile_prediction/ProjPredEngineLegacy.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// Created by Vlad on 6/9/2024.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include "omath/Vector3.hpp"
|
||||
#include "omath/projectile_prediction/ProjPredEngine.hpp"
|
||||
#include "omath/projectile_prediction/Projectile.hpp"
|
||||
#include "omath/projectile_prediction/Target.hpp"
|
||||
|
||||
|
||||
namespace omath::projectile_prediction
|
||||
{
|
||||
class ProjPredEngineLegacy final : public ProjPredEngine
|
||||
{
|
||||
public:
|
||||
explicit ProjPredEngineLegacy(float gravityConstant, float simulationTimeStep, float maximumSimulationTime,
|
||||
float distanceTolerance);
|
||||
|
||||
[[nodiscard]]
|
||||
std::optional<Vector3> MaybeCalculateAimPoint(const Projectile& projectile,
|
||||
const Target& target) const override;
|
||||
|
||||
private:
|
||||
const float m_gravityConstant;
|
||||
const float m_simulationTimeStep;
|
||||
const float m_maximumSimulationTime;
|
||||
const float m_distanceTolerance;
|
||||
|
||||
[[nodiscard]]
|
||||
std::optional<float> MaybeCalculateProjectileLaunchPitchAngle(const Projectile& projectile,
|
||||
const Vector3& targetPosition) const;
|
||||
|
||||
|
||||
[[nodiscard]]
|
||||
bool IsProjectileReachedTarget(const Vector3& targetPosition, const Projectile& projectile, float pitch,
|
||||
float time) const;
|
||||
};
|
||||
} // namespace omath::projectile_prediction
|
||||
Reference in New Issue
Block a user