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

Typedefs

using neighbor_metric = manhattan_metric
 
using surrounding_metric = chebyshev_metric
 
using tile_pos = named< glm::ivec2, "tile_pos", traits::location >
 
using world_pos = named< glm::vec2, "world_pos", traits::location >
 
using tile_rec = named< irec2, "tile_rec">
 
using world_rec = named< rec2, "world_rec">
 

Functions

template<typename TILE_DATA , bool RESIZABLE, typename FUNC >
void apply_cellular_automata (grid< TILE_DATA, RESIZABLE > &current_iteration, irec2 const &rect, FUNC &&func)
 
template<typename TILE_DATA , bool RESIZABLE, typename FUNC >
void apply_cellular_automata (grid< TILE_DATA, RESIZABLE > &current_iteration, FUNC &&func)
 
template<typename TILE_DATA , bool RESIZABLE, change_tile_callback< TILE_DATA > FLOOD_FUNC, query_tile_callback< TILE_DATA > SHOULD_FLOOD_FUNC>
void flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, FLOOD_FUNC &&flood, SHOULD_FLOOD_FUNC &&should_flood)
 
template<typename TILE_DATA , bool RESIZABLE, change_tile_callback< TILE_DATA > FLOOD_FUNC>
void flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, FLOOD_FUNC &&flood)
 
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)
 
template<typename TILE_DATA , bool RESIZABLE>
void flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, TILE_DATA const &replace_with)
 
constexpr bool is_surrounding (glm::ivec2 a, glm::ivec2 b)
 TODO: Should probably define the terms somewhere (surrounding, neighbor, adjacent, tile, world, etc)
 
constexpr bool is_neighbor (glm::ivec2 a, glm::ivec2 b)
 
constexpr bool is_diagonal_neighbor (glm::ivec2 a, glm::ivec2 b)
 
template<std::integral T>
constexpr auto manhattan_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)
 
constexpr glm::vec2 tile_pos_to_world_pos (glm::ivec2 tile_pos, glm::vec2 tile_size)
 
constexpr glm::vec2 tile_pos_to_world_pos (glm::ivec2 tile_pos, float tile_size)
 
constexpr rec2 world_rect_for_tile (glm::ivec2 pos, glm::vec2 tile_size)
 
constexpr rec2 world_rect_for_tile (glm::ivec2 pos, float tile_size)
 
glm::ivec2 world_pos_to_tile_pos (glm::vec2 world_pos, glm::vec2 tile_size)
 
glm::ivec2 world_pos_to_tile_pos (glm::vec2 world_pos, float tile_size)
 
irec2 world_rect_to_tile_rect (rec2 const &world_rect, glm::vec2 tile_size)
 
irec2 world_rect_to_tile_rect (rec2 const &world_rect, float tile_size)
 
glm::vec2 snap_world_pos_to_tile_grid (glm::vec2 world_pos, glm::vec2 tile_size)
 

Detailed Description

Typedef Documentation

◆ neighbor_metric

using ghassanpl::geometry::squares::neighbor_metric = typedef manhattan_metric

Definition at line 40 of file squares.h.

◆ surrounding_metric

using ghassanpl::geometry::squares::surrounding_metric = typedef chebyshev_metric

Definition at line 62 of file squares.h.

◆ tile_pos

using ghassanpl::geometry::squares::tile_pos = typedef named<glm::ivec2, "tile_pos", traits::location>

Definition at line 101 of file squares.h.

◆ tile_rec

using ghassanpl::geometry::squares::tile_rec = typedef named<irec2, "tile_rec">

Definition at line 104 of file squares.h.

◆ world_pos

using ghassanpl::geometry::squares::world_pos = typedef named<glm::vec2, "world_pos", traits::location>

Definition at line 102 of file squares.h.

◆ world_rec

using ghassanpl::geometry::squares::world_rec = typedef named<rec2, "world_rec">

Definition at line 105 of file squares.h.

Function Documentation

◆ apply_cellular_automata() [1/2]

template<typename TILE_DATA , bool RESIZABLE, typename FUNC >
void ghassanpl::geometry::squares::apply_cellular_automata ( grid< TILE_DATA, RESIZABLE > &  current_iteration,
FUNC &&  func 
)

Definition at line 49 of file square_grid_algorithms.h.

◆ apply_cellular_automata() [2/2]

template<typename TILE_DATA , bool RESIZABLE, typename FUNC >
void ghassanpl::geometry::squares::apply_cellular_automata ( grid< TILE_DATA, RESIZABLE > &  current_iteration,
irec2 const rect,
FUNC &&  func 
)

Definition at line 13 of file square_grid_algorithms.h.

◆ chebyshev_distance()

template<std::integral T>
constexpr auto ghassanpl::geometry::squares::chebyshev_distance ( glm::tvec2< T >  a,
glm::tvec2< T >  b 
)
constexpr

Definition at line 71 of file squares.h.

◆ flood_at() [1/4]

template<typename TILE_DATA , bool RESIZABLE, change_tile_callback< TILE_DATA > FLOOD_FUNC>
void ghassanpl::geometry::squares::flood_at ( grid< TILE_DATA, RESIZABLE > &  grid,
glm::ivec2  start,
FLOOD_FUNC &&  flood 
)

Definition at line 95 of file square_grid_algorithms.h.

◆ flood_at() [2/4]

template<typename TILE_DATA , bool RESIZABLE, change_tile_callback< TILE_DATA > FLOOD_FUNC, query_tile_callback< TILE_DATA > SHOULD_FLOOD_FUNC>
void ghassanpl::geometry::squares::flood_at ( grid< TILE_DATA, RESIZABLE > &  grid,
glm::ivec2  start,
FLOOD_FUNC &&  flood,
SHOULD_FLOOD_FUNC &&  should_flood 
)

Definition at line 56 of file square_grid_algorithms.h.

◆ flood_at() [3/4]

template<typename TILE_DATA , bool RESIZABLE>
void ghassanpl::geometry::squares::flood_at ( grid< TILE_DATA, RESIZABLE > &  grid,
glm::ivec2  start,
TILE_DATA const replace_with 
)

Definition at line 109 of file square_grid_algorithms.h.

◆ flood_at() [4/4]

template<typename TILE_DATA , bool RESIZABLE, query_tile_callback< TILE_DATA > SHOULD_FLOOD_FUNC>
void ghassanpl::geometry::squares::flood_at ( grid< TILE_DATA, RESIZABLE > &  grid,
glm::ivec2  start,
TILE_DATA const replace_with,
SHOULD_FLOOD_FUNC &&  should_flood 
)

Definition at line 103 of file square_grid_algorithms.h.

◆ is_diagonal_neighbor()

constexpr bool ghassanpl::geometry::squares::is_diagonal_neighbor ( glm::ivec2  a,
glm::ivec2  b 
)
constexpr

Definition at line 15 of file squares.h.

◆ is_neighbor()

constexpr bool ghassanpl::geometry::squares::is_neighbor ( glm::ivec2  a,
glm::ivec2  b 
)
constexpr

Definition at line 14 of file squares.h.

◆ is_surrounding()

constexpr bool ghassanpl::geometry::squares::is_surrounding ( glm::ivec2  a,
glm::ivec2  b 
)
constexpr

TODO: Should probably define the terms somewhere (surrounding, neighbor, adjacent, tile, world, etc)

Definition at line 13 of file squares.h.

◆ manhattan_distance()

template<std::integral T>
constexpr auto ghassanpl::geometry::squares::manhattan_distance ( glm::tvec2< T >  a,
glm::tvec2< T >  b 
)
constexpr

Definition at line 65 of file squares.h.

◆ snap_world_pos_to_tile_grid()

glm::vec2 ghassanpl::geometry::squares::snap_world_pos_to_tile_grid ( glm::vec2  world_pos,
glm::vec2  tile_size 
)

Definition at line 86 of file squares.h.

◆ tile_pos_to_world_pos() [1/2]

constexpr glm::vec2 ghassanpl::geometry::squares::tile_pos_to_world_pos ( glm::ivec2  tile_pos,
float  tile_size 
)
constexpr

Definition at line 77 of file squares.h.

◆ tile_pos_to_world_pos() [2/2]

constexpr glm::vec2 ghassanpl::geometry::squares::tile_pos_to_world_pos ( glm::ivec2  tile_pos,
glm::vec2  tile_size 
)
constexpr

Definition at line 76 of file squares.h.

◆ world_pos_to_tile_pos() [1/2]

glm::ivec2 ghassanpl::geometry::squares::world_pos_to_tile_pos ( glm::vec2  world_pos,
float  tile_size 
)

Definition at line 82 of file squares.h.

◆ world_pos_to_tile_pos() [2/2]

glm::ivec2 ghassanpl::geometry::squares::world_pos_to_tile_pos ( glm::vec2  world_pos,
glm::vec2  tile_size 
)

Definition at line 81 of file squares.h.

◆ world_rect_for_tile() [1/2]

constexpr rec2 ghassanpl::geometry::squares::world_rect_for_tile ( glm::ivec2  pos,
float  tile_size 
)
constexpr

Definition at line 79 of file squares.h.

◆ world_rect_for_tile() [2/2]

constexpr rec2 ghassanpl::geometry::squares::world_rect_for_tile ( glm::ivec2  pos,
glm::vec2  tile_size 
)
constexpr

Definition at line 78 of file squares.h.

◆ world_rect_to_tile_rect() [1/2]

irec2 ghassanpl::geometry::squares::world_rect_to_tile_rect ( rec2 const world_rect,
float  tile_size 
)

Definition at line 84 of file squares.h.

◆ world_rect_to_tile_rect() [2/2]

irec2 ghassanpl::geometry::squares::world_rect_to_tile_rect ( rec2 const world_rect,
glm::vec2  tile_size 
)

Definition at line 83 of file squares.h.