Horizon Official Technical Documentation
Horizon::Zone::AStar::Heuristic Class Reference

#include <AStar.hpp>

Static Public Member Functions

static uint32_t manhattan (MapCoords source_, MapCoords target_)
 
static uint32_t euclidean (MapCoords source_, MapCoords target_)
 
static uint32_t octagonal (MapCoords source_, MapCoords target_)
 

Static Private Member Functions

static MapCoords getDelta (MapCoords source_, MapCoords target_)
 

Member Function Documentation

◆ euclidean()

static uint32_t Horizon::Zone::AStar::Heuristic::euclidean ( MapCoords  source_,
MapCoords  target_ 
)
inlinestatic
62 {
63 auto delta = getDelta(source_, target_);
64 return static_cast<uint32_t>(10 * std::sqrt(std::pow(delta.x(), 2) + std::pow(delta.y(), 2)));
65 }
static MapCoords getDelta(MapCoords source_, MapCoords target_)
Definition: AStar.hpp:52

References getDelta().

+ Here is the call graph for this function:

◆ getDelta()

static MapCoords Horizon::Zone::AStar::Heuristic::getDelta ( MapCoords  source_,
MapCoords  target_ 
)
inlinestaticprivate
52{ return MapCoords(abs(target_.x() - source_.x()), abs(target_.y() - source_.y())); }
Coordinates< MAX_CELLS_PER_MAP > MapCoords
Definition: GridDefinitions.hpp:83
int16_t y() const
Definition: Coordinates.hpp:120
int16_t x() const
Definition: Coordinates.hpp:119

References Coordinates< MAX_COORDINATES >::x(), and Coordinates< MAX_COORDINATES >::y().

Referenced by euclidean(), manhattan(), and octagonal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ manhattan()

static uint32_t Horizon::Zone::AStar::Heuristic::manhattan ( MapCoords  source_,
MapCoords  target_ 
)
inlinestatic
56 {
57 auto delta = getDelta(source_, target_);
58 return static_cast<uint32_t>(10 * (delta.x() + delta.y()));
59 }

References getDelta().

Referenced by BOOST_AUTO_TEST_CASE(), and Horizon::Zone::AStar::Generator::Generator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ octagonal()

static uint32_t Horizon::Zone::AStar::Heuristic::octagonal ( MapCoords  source_,
MapCoords  target_ 
)
inlinestatic
68 {
69 auto delta = getDelta(source_, target_);
70 return 10 * (delta.x() + delta.y()) + (-6) * std::min(delta.x(), delta.y());
71 }

References getDelta().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: