sKit  0.0.9
sKit::structure Namespace Reference

Classes

class  BRect
 
class  BRectBase
 The base class of BRect implemented as CRTP. Do not use directly. More...
 
struct  Dimensions
 

Functions

auto gridFillDiagonal (int numCols, int numRows) -> std::vector< glm::ivec2 >
 Creates a path following the coordinates of every cell in a grid that has a diagonal tendency. More...
 
constexpr glm::ivec2 N (0, -1)
 Unit int vector North. More...
 
constexpr glm::ivec2 E (1, 0)
 Unit int vector East. More...
 
constexpr glm::ivec2 S (0, 1)
 Unit int vector South. More...
 
constexpr glm::ivec2 W (-1, 0)
 Unit int vector West. More...
 
constexpr glm::ivec2 NE (1, -1)
 Unit int vector North-East. More...
 
constexpr glm::ivec2 SW (-1, 1)
 Unit int vector South-West. More...
 

Function Documentation

◆ E()

constexpr glm::ivec2 sKit::structure::E ( ,
 
)
constexpr

Unit int vector East.

Referenced by gridFillDiagonal().

◆ gridFillDiagonal()

auto sKit::structure::gridFillDiagonal ( int  numCols,
int  numRows 
) -> std::vector< glm::ivec2 >

Creates a path following the coordinates of every cell in a grid that has a diagonal tendency.

Example of a 3x3 grid and the path that fills it:

┌────┬────┬────┐
│ 1 │ 2 │ 6 │
├────┼────┼────┤
│ 3 │ 5 │ 7 │
├────┼────┼────┤
│ 4 │ 8 │ 9 │
└────┴────┴────┘
Exceptions
std::runtime_errorIf either numCols or numRows are less than 2.
Returns
Every point in a numCols by numRows grid.

Definition at line 8 of file grids.cpp.

References E(), NE(), S(), and SW().

◆ N()

constexpr glm::ivec2 sKit::structure::N ( ,
1 
)
constexpr

Unit int vector North.

◆ NE()

constexpr glm::ivec2 sKit::structure::NE ( ,
1 
)
constexpr

Unit int vector North-East.

Referenced by gridFillDiagonal().

◆ S()

constexpr glm::ivec2 sKit::structure::S ( ,
 
)
constexpr

Unit int vector South.

Referenced by gridFillDiagonal().

◆ SW()

constexpr glm::ivec2 sKit::structure::SW ( 1,
 
)
constexpr

Unit int vector South-West.

Referenced by gridFillDiagonal().

◆ W()

constexpr glm::ivec2 sKit::structure::W ( 1,
 
)
constexpr

Unit int vector West.