header_utils
Loading...
Searching...
No Matches
ghassanpl::geometry::squares::metric Concept Reference

Any type that meets the criteria of a metric - specifying the adjacency/distances between squares. More...

#include <squares.h>

Concept definition

template<typename METRIC, typename T>
concept metric = std::integral<T> && requires (T t, glm::tvec2<T> vec) {
Any type that meets the criteria of a metric - specifying the adjacency/distances between squares.
Definition squares.h:49

is_adjacent(vec, vec) should return whether two squares are adjacent

{ METRIC::is_adjacent(vec, vec) } -> std::convertible_to<bool>;

is_adjacent(direction) should return whether a square in the direction of another square is adjacent

{ METRIC::is_adjacent(direction{}) } -> std::convertible_to<bool>;

distance(vec, vec) should return a tile distance between two tile positions within this metric. Note that this is different than the concept of distances in a world (where tiles have sizes). The distance here can be thought of as the minimum number of 'hops' between adjacent squares to move from one position to another.

{ METRIC::distance(vec, vec) } -> std::convertible_to<T>;
}

Detailed Description

Any type that meets the criteria of a metric - specifying the adjacency/distances between squares.

Definition at line 49 of file squares.h.