VIPRA Documentation
Loading...
Searching...
No Matches
astar.hpp
1#pragma once
2
3#include "pathing_graph.hpp"
4
5#include "vipra/geometry/f3d.hpp"
6
7#include "vipra/geometry/polygon.hpp"
8
9#include "vipra/macros/goals.hpp"
10#include "vipra/macros/module.hpp"
11#include "vipra/macros/parameters.hpp"
12
13#include "vipra/modules/goals.hpp"
14#include "vipra/modules/pedestrians.hpp"
15#include "vipra/random/random.hpp"
16
17namespace VIPRA::Goals {
18
23class AStar : public VIPRA::Modules::Module<AStar>, public VIPRA::Modules::Goals {
24 public:
25 VIPRA_MODULE_NAME("AStar")
26 VIPRA_MODULE_TYPE(Goals)
27
28 VIPRA_REGISTER_PARAMS(VIPRA_PARAM("endGoalType", _endGoalType),
29 VIPRA_PARAM("goalRange", _goalRange),
30 VIPRA_PARAM("gridSize", _gridSize),
31 VIPRA_PARAM("closestObstacle", _closestObstacle),
32 VIPRA_PARAM("pathSmoothing", _pathEpsilon))
33
34 VIPRA_GOALS_INIT_STEP;
35 VIPRA_GOALS_UPDATE_STEP;
36 VIPRA_GOALS_NEXT_GOAL;
37 VIPRA_GOALS_CHANGE_GOAL;
38 VIPRA_GOALS_RESET;
39
40 private:
41 std::string _endGoalType;
42 VIPRA::f_pnt _goalRange;
43 VIPRA::f_pnt _gridSize;
44 VIPRA::f_pnt _closestObstacle;
45 VIPRA::f_pnt _pathEpsilon;
46
47 std::vector<std::vector<VIPRA::f3d>> _paths;
48 PathingGraph _graph;
49
50 void set_end_goals(VIPRA::Modules::Pedestrians const& pedset,
51 VIPRA::Modules::Map const& map, VIPRA::Random::Engine& engine);
52
53 [[nodiscard]] static auto get_nearest_goal(
54 VIPRA::f3d pos, std::vector<VIPRA::Geometry::Polygon> const& goals)
55 -> std::vector<VIPRA::Geometry::Polygon>::const_iterator;
56
57 void find_path(VIPRA::idx pedIdx, VIPRA::f3d startPos);
58 [[nodiscard]] auto find_random_point(VIPRA::Geometry::Polygon const&,
61};
62} // namespace VIPRA::Goals
Definition polygon.hpp:18
Goals module that uses the A* algorithm to find the path to the goal.
Definition astar.hpp:23
Definition pathing_graph.hpp:19
Goals module mixin.
Definition goals.hpp:26
Base Map Module Class.
Definition map.hpp:23
VIPRA Module Base CRTP Class.
Definition module.hpp:36
Base Pedestrians module.
Definition pedestrians.hpp:35
Psuedo Random number engine.
Definition random.hpp:22
Definition f3d.hpp:27