Display content rendering. More...
Data Structures | |
struct | renderer_t |
An object that returns frames indefinitely. More... | |
String grid distance | |
uint8_t | get_string_distance (uint8_t x, uint8_t y) |
Calculate the distance between strings x and y (zero-indexed) More... | |
#define | get_string_distance_to_centre(string) get_string_distance((string), 35); |
Display content rendering.
For stand-alone operation an device testing, a frame renderer interface was developed. Depending on the device state, one renderer is selected and used to generate frames that are pushed into the frame queue. Every time a frame is consumed, the current renderer's renderer_t::render_frame() function is called to generate the next frame.
#define get_string_distance_to_centre | ( | string | ) | get_string_distance((string), 35); |
Calculate the distance between a strings (zero-indexed) and the center of the array (string 36). This is equivalent to calling get_string_distance(string, 35).
uint8_t get_string_distance | ( | uint8_t | x, |
uint8_t | y | ||
) |
Calculate the distance between strings x and y (zero-indexed)
A hexagonal lattice may be constructed from a regular, 3D square grid by taking the plane satisfying the eqaution \(x+y+z=0\). If the pair \((x,y)\) is mapped onto a 2D space given by \((v,w)\), this plane equation determines \(z\). The distance \(D\) between 2 points on a hexagonal grid is given by
\begin{eqnarray*} D &=& 0.5 (|x_1-x_2| + |y_1-y_2| + |z_1-z_2|) \\ &=& 0.5 (|v_1-v_2| + |w_1-w_2| + |(v_1-v_2)-(w_1-w_2)|) \end{eqnarray*}