header_utils
Loading...
Searching...
No Matches
ghassanpl::geometry::squares::ttile_space< I, F, METRIC > Struct Template Reference

Combines a metric and tile size into a single type. More...

#include <squares.h>

Public Types

using metric
using vec2
using ivec2
using rec2
using irec2
using tile_pos
using world_pos
using tile_rec
using world_rec

Public Member Functions

constexpr vec2 to_world_pos (ivec2 tile_pos) const noexcept
constexpr rec2 world_rect_for_tile (ivec2 tile_pos) const noexcept
constexpr ivec2 to_tile_pos (vec2 world_pos) const noexcept
constexpr irec2 to_tile_rect (rec2 const &world_rect) const noexcept
vec2 snap_to_grid (vec2 world_pos) const
constexpr world_pos to_world_pos (tile_pos tile_pos) const noexcept
constexpr world_rec world_rect_for_tile (tile_pos tile_pos) const noexcept
constexpr tile_pos to_tile_pos (world_pos world_pos) const noexcept
constexpr tile_rec to_tile_rect (world_rec const &world_rect) const noexcept
world_pos snap_to_grid (world_pos world_pos) const

Static Public Member Functions

static constexpr auto is_adjacent (ivec2 a, ivec2 b)
static constexpr auto is_adjacent (tile_pos a, tile_pos b)
static constexpr auto is_adjacent (direction dir)
static constexpr auto tile_distance (ivec2 a, ivec2 b)
static constexpr auto tile_distance (tile_pos a, tile_pos b)

Public Attributes

vec2 tile_size

Detailed Description

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
struct ghassanpl::geometry::squares::ttile_space< I, F, METRIC >

Combines a metric and tile size into a single type.

Definition at line 160 of file squares.h.

Member Typedef Documentation

◆ irec2

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
using ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::irec2

Definition at line 166 of file squares.h.

◆ ivec2

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
using ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::ivec2

Definition at line 164 of file squares.h.

◆ metric

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
using ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::metric

Definition at line 162 of file squares.h.

◆ rec2

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
using ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::rec2

Definition at line 165 of file squares.h.

◆ tile_pos

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
using ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::tile_pos

Definition at line 168 of file squares.h.

◆ tile_rec

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
using ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::tile_rec

Definition at line 171 of file squares.h.

◆ vec2

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
using ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::vec2

Definition at line 163 of file squares.h.

◆ world_pos

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
using ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::world_pos

Definition at line 169 of file squares.h.

◆ world_rec

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
using ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::world_rec

Definition at line 172 of file squares.h.

Member Function Documentation

◆ is_adjacent() [1/3]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
constexpr auto ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::is_adjacent ( direction dir)
inlinestaticconstexpr

Definition at line 192 of file squares.h.

◆ is_adjacent() [2/3]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
constexpr auto ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::is_adjacent ( ivec2 a,
ivec2 b )
inlinestaticconstexpr

Definition at line 190 of file squares.h.

◆ is_adjacent() [3/3]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
constexpr auto ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::is_adjacent ( tile_pos a,
tile_pos b )
inlinestaticconstexpr

Definition at line 191 of file squares.h.

◆ snap_to_grid() [1/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
vec2 ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::snap_to_grid ( vec2 world_pos) const
inline

Definition at line 181 of file squares.h.

◆ snap_to_grid() [2/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
world_pos ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::snap_to_grid ( world_pos world_pos) const
inline

Definition at line 188 of file squares.h.

◆ tile_distance() [1/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
constexpr auto ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::tile_distance ( ivec2 a,
ivec2 b )
inlinestaticconstexpr

Definition at line 193 of file squares.h.

◆ tile_distance() [2/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
constexpr auto ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::tile_distance ( tile_pos a,
tile_pos b )
inlinestaticconstexpr

Definition at line 194 of file squares.h.

◆ to_tile_pos() [1/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
ivec2 ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::to_tile_pos ( vec2 world_pos) const
inlineconstexprnoexcept

Definition at line 178 of file squares.h.

◆ to_tile_pos() [2/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
tile_pos ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::to_tile_pos ( world_pos world_pos) const
inlineconstexprnoexcept

Definition at line 185 of file squares.h.

◆ to_tile_rect() [1/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
irec2 ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::to_tile_rect ( rec2 const & world_rect) const
inlineconstexprnoexcept

Definition at line 179 of file squares.h.

◆ to_tile_rect() [2/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
tile_rec ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::to_tile_rect ( world_rec const & world_rect) const
inlineconstexprnoexcept

Definition at line 186 of file squares.h.

◆ to_world_pos() [1/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
vec2 ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::to_world_pos ( ivec2 tile_pos) const
inlineconstexprnoexcept

Definition at line 176 of file squares.h.

◆ to_world_pos() [2/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
world_pos ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::to_world_pos ( tile_pos tile_pos) const
inlineconstexprnoexcept

Definition at line 183 of file squares.h.

◆ world_rect_for_tile() [1/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
rec2 ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::world_rect_for_tile ( ivec2 tile_pos) const
inlineconstexprnoexcept

Definition at line 177 of file squares.h.

◆ world_rect_for_tile() [2/2]

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
world_rec ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::world_rect_for_tile ( tile_pos tile_pos) const
inlineconstexprnoexcept

Definition at line 184 of file squares.h.

Member Data Documentation

◆ tile_size

template<std::integral I, std::floating_point F, metric< I > METRIC = chebyshev_metric>
vec2 ghassanpl::geometry::squares::ttile_space< I, F, METRIC >::tile_size

Definition at line 174 of file squares.h.