Corner.short_neighbours are now searched for based on the coordinates of the nodes.

This commit is contained in:
2021-01-08 22:21:44 +01:00
parent 2715d5aa6a
commit 40efeee436
3 changed files with 42 additions and 9 deletions

View File

@ -7,7 +7,7 @@
// Delta-X data. Per direction of a triangle is a triple with Delta-X values for each direction.
static const int8_t dx[][3] = {{0, 1, -1}, {1, 0, -1}, {1, -1, 0}, {0, -1, 1}, {-1, 0, 1}, {-1, 1, 0}};
static const int8_t dy[][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, -1}, {1, 0, 0}, {0, -1, 0}, {0, 0, 1}};
static const int8_t dy[][3] = {{-1, 0, 0}, {0, 1, 0}, {0, 0, -1}, {1, 0, 0}, {0, -1, 0}, {0, 0, 1}};
typedef struct {
int8_t x;
@ -15,10 +15,8 @@ typedef struct {
} Coords;
class Node {
private:
uint16_t _number;
Coords coords_at_direction(uint8_t edge);
public:
uint16_t _number;
Coords coords;
uint8_t direction;
Node* neighbours[CORNERS_PER_PART];
@ -26,6 +24,7 @@ class Node {
Corner* _corners[CORNERS_PER_PART];
Node(uint16_t number, Coords c, uint8_t direction);
Node* create_neighbour(uint8_t edge);
Coords coords_at_direction(uint8_t edge);
void blend_to(CRGB color, uint16_t effect_id=0, uint8_t effect_speed=0);
void set_color(CRGB color);