mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 15:03:27 +00:00
31 lines
961 B
C++
31 lines
961 B
C++
//
|
|
// Created by Vlad on 28.07.2024.
|
|
//
|
|
|
|
#pragma once
|
|
#include "omath/pathfinding/navigation_mesh.hpp"
|
|
#include "omath/vector3.hpp"
|
|
#include <vector>
|
|
|
|
namespace omath::pathfinding
|
|
{
|
|
struct PathNode;
|
|
class Astar final
|
|
{
|
|
public:
|
|
[[nodiscard]]
|
|
static std::vector<Vector3<float>> find_path(const Vector3<float>& start, const Vector3<float>& end,
|
|
const NavigationMesh& nav_mesh) noexcept;
|
|
|
|
private:
|
|
[[nodiscard]]
|
|
static std::vector<Vector3<float>>
|
|
reconstruct_final_path(const std::unordered_map<Vector3<float>, PathNode>& closed_list,
|
|
const Vector3<float>& current) noexcept;
|
|
|
|
[[nodiscard]]
|
|
static auto get_perfect_node(const std::unordered_map<Vector3<float>, PathNode>& open_list,
|
|
const Vector3<float>& end_vertex) noexcept;
|
|
};
|
|
} // namespace omath::pathfinding
|