|
| template<std::integral T> |
| constexpr bool | ghassanpl::geometry::squares::is_surrounding (glm::tvec2< T > a, glm::tvec2< T > b) |
| template<std::integral T> |
| constexpr bool | ghassanpl::geometry::squares::is_neighbor (glm::tvec2< T > a, glm::tvec2< T > b) |
| template<std::integral T> |
| constexpr bool | ghassanpl::geometry::squares::is_diagonal_neighbor (glm::tvec2< T > a, glm::tvec2< T > b) |
| template<std::integral T> |
| constexpr auto | ghassanpl::geometry::squares::manhattan_distance (glm::tvec2< T > a, glm::tvec2< T > b) |
| template<std::integral T> |
| constexpr auto | ghassanpl::geometry::squares::neighbor_distance (glm::tvec2< T > a, glm::tvec2< T > b) |
| template<std::integral T> |
| constexpr auto | ghassanpl::geometry::squares::chebyshev_distance (glm::tvec2< T > a, glm::tvec2< T > b) |
| template<std::integral T> |
| constexpr auto | ghassanpl::geometry::squares::surrounding_distance (glm::tvec2< T > a, glm::tvec2< T > b) |
| template<std::integral I, std::floating_point F> |
| constexpr glm::tvec2< F > | ghassanpl::geometry::squares::tile_pos_to_world_pos (glm::tvec2< I > tile_pos, glm::tvec2< F > tile_size) |
| template<std::integral I, std::floating_point F> |
| constexpr glm::tvec2< F > | ghassanpl::geometry::squares::tile_pos_to_world_pos (glm::tvec2< I > tile_pos, F tile_size) |
| template<std::integral I, std::floating_point F> |
| constexpr trec2< F > | ghassanpl::geometry::squares::world_rect_for_tile (glm::tvec2< I > pos, glm::tvec2< F > tile_size) |
| template<std::integral I, std::floating_point F> |
| constexpr trec2< F > | ghassanpl::geometry::squares::world_rect_for_tile (glm::tvec2< I > pos, F tile_size) |
| template<std::integral I = int, std::floating_point F> |
| glm::tvec2< I > | ghassanpl::geometry::squares::world_pos_to_tile_pos (glm::tvec2< F > world_pos, glm::tvec2< F > tile_size) |
| template<std::integral I = int, std::floating_point F> |
| glm::tvec2< I > | ghassanpl::geometry::squares::world_pos_to_tile_pos (glm::tvec2< F > world_pos, F tile_size) |
| template<std::integral I = int, std::floating_point F> |
| trec2< I > | ghassanpl::geometry::squares::world_rect_to_tile_rect (trec2< F > const &world_rect, glm::tvec2< F > tile_size) |
| template<std::integral I = int, std::floating_point F> |
| trec2< I > | ghassanpl::geometry::squares::world_rect_to_tile_rect (trec2< F > const &world_rect, F tile_size) |
| template<std::floating_point F> |
| glm::tvec2< F > | ghassanpl::geometry::squares::snap_world_pos_to_tile_grid (glm::tvec2< F > world_pos, glm::tvec2< F > tile_size) |
Operations on positions in a 2D square grid.
Square positions are defined as two integers x and y, in the primary position type glm::ivec2. The distances between these positions are dependent on the metric chosen.
Definitions:
- grid - a bounded or unbounded integer coordinate space that bijects a position in the space to an object called a square or tile
- tile - another name for square
- metric - the means to calculate distances between two squares
- adjacency - in a specified metric, two squares are considered "adjacent" if the distance between their positions is 1
- neighbor of S - a square N is considered the neighbor of square S if it shares an edge with S
- diagonal neighbor of S - a square N is considered the diagonal neighbor of square S if it shares a vertex with S
- square surrounding S - a square N is considered in the surrounding of square S if it shares an edge OR vertex with S
- the surrounding of S - all squares that are considered to be surrounding S
- tile space - a combination of a metric and a tile size; usually defined as part of a world
- world - a set of unique squares that form a grid within a tile space, either unbounded, or bounded by a rectangle edge; the squares have integral positions, and every position within the bounds refers to a unique square, but world can have non-integral "world" positions defined on it as well
- tile position - the integral position of a single tile in a world; every position within world bounds refers to a unique square in the world
- tile size - a world can define the geometrical extents of a single square/tile; these can then be used to define the world positions
- world position - the real-number, euclidean position inside a world; in general, the originating world position of a tile is given by: tile_position * tile_size
The tile space and world concepts may, in some cases, be used interchangeably, as they have similar properties in this context. In general, a world is both the container of all the squares and their data (as the grid type represents) and the set of properties (like the tile space) to operate within it.