header_utils
Loading...
Searching...
No Matches
ghassanpl::geometry::squares Namespace Reference

Classes

struct  grid
 A container for squares in a 2D square grid. More...
struct  manhattan_metric
 Metric in which only neighbors are adjacent. More...
struct  chebyshev_metric
 Metric in which the entire surrounding is adjacent. More...
struct  ttile_space
 Combines a metric and tile size into a single type. More...

Concepts

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

Typedefs

using neighbor_metric
using surrounding_metric
using chebyshev_tile_space
using manhattan_tile_space
using tile_pos
 Tile position with int values.
using world_pos
 World position with float values.
using tile_rec
 Tile rectangle with int values.
using world_rec
 World rectangle with float values.

Functions

template<std::integral T>
constexpr bool is_surrounding (glm::tvec2< T > a, glm::tvec2< T > b)
template<std::integral T>
constexpr bool is_neighbor (glm::tvec2< T > a, glm::tvec2< T > b)
template<std::integral T>
constexpr bool is_diagonal_neighbor (glm::tvec2< T > a, glm::tvec2< T > b)
template<std::integral T>
constexpr auto manhattan_distance (glm::tvec2< T > a, glm::tvec2< T > b)
template<std::integral T>
constexpr auto neighbor_distance (glm::tvec2< T > a, glm::tvec2< T > b)
template<std::integral T>
constexpr auto chebyshev_distance (glm::tvec2< T > a, glm::tvec2< T > b)
template<std::integral T>
constexpr auto surrounding_distance (glm::tvec2< T > a, glm::tvec2< T > b)
template<std::integral I, std::floating_point F>
constexpr glm::tvec2< F > 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 > tile_pos_to_world_pos (glm::tvec2< I > tile_pos, F tile_size)
template<std::integral I, std::floating_point F>
constexpr trec2< F > world_rect_for_tile (glm::tvec2< I > pos, glm::tvec2< F > tile_size)
template<std::integral I, std::floating_point F>
constexpr trec2< F > world_rect_for_tile (glm::tvec2< I > pos, F tile_size)
template<std::integral I = int, std::floating_point F>
glm::tvec2< I > 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 > world_pos_to_tile_pos (glm::tvec2< F > world_pos, F tile_size)
template<std::integral I = int, std::floating_point F>
trec2< I > 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 > world_rect_to_tile_rect (trec2< F > const &world_rect, F tile_size)
template<std::floating_point F>
glm::tvec2< F > snap_world_pos_to_tile_grid (glm::tvec2< F > world_pos, glm::tvec2< F > tile_size)
template<typename TILE_DATA, bool RESIZABLE, typename FUNC>
void apply_cellular_automata (grid< TILE_DATA, RESIZABLE > &current_iteration, irec2 const &rect, FUNC &&func)
 Applies a cellular automata generation function on (a region of) the grid.
template<typename TILE_DATA, bool RESIZABLE, typename FUNC>
void apply_cellular_automata (grid< TILE_DATA, RESIZABLE > &current_iteration, FUNC &&func)
 Applies a cellular automata generation function on (a region of) the grid.
template<typename TILE_DATA, bool RESIZABLE, typename FUNC>
void apply_cellular_automata (grid< TILE_DATA, RESIZABLE > const &current_iteration, grid< TILE_DATA, RESIZABLE > &new_iteration, irec2 const &rect, FUNC &&func)
 TODO: This.
template<typename TILE_DATA, bool RESIZABLE, change_tile_callback< TILE_DATA > REPLACE_FUNC, query_tile_callback< TILE_DATA > SHOULD_FLOOD_FUNC>
void flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, REPLACE_FUNC &&replace, SHOULD_FLOOD_FUNC &&should_flood)
 Performs a flood-fill algorithm on grid.
template<typename TILE_DATA, bool RESIZABLE, change_tile_callback< TILE_DATA > REPLACE_FUNC>
void flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, REPLACE_FUNC &&replace)
 Performs a flood-fill algorithm on grid.
template<typename TILE_DATA, bool RESIZABLE, query_tile_callback< TILE_DATA > SHOULD_FLOOD_FUNC>
void flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, TILE_DATA const &replace_with, SHOULD_FLOOD_FUNC &&should_flood)
 Performs a flood-fill algorithm on grid.
template<typename TILE_DATA, bool RESIZABLE>
void flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, TILE_DATA const &replace_with)
 Performs a flood-fill algorithm on grid.

Detailed Description