Removed Edge class. Wasn't needed. Nodes and Corners are anough.
This commit is contained in:
parent
db76255a2c
commit
e9143b6ca8
@ -1,14 +1,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
class Corner;
|
||||||
|
|
||||||
#include "my_fastled.h"
|
#include "my_fastled.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "edge.h"
|
#include "node.h"
|
||||||
|
|
||||||
class Corner {
|
class Corner {
|
||||||
public:
|
public:
|
||||||
Edge* e1;
|
Node* node;
|
||||||
Edge* e2;
|
uint8_t number;
|
||||||
Corner(Edge* e1, Edge* e2);
|
Corner(Node* node, uint8_t number);
|
||||||
std::list<uint16_t> _leds;
|
std::list<uint16_t> _leds;
|
||||||
std::vector<Corner*> _long_neighbours {};
|
std::vector<Corner*> _long_neighbours {};
|
||||||
std::vector<Corner*> _short_neighbours {};
|
std::vector<Corner*> _short_neighbours {};
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
class Edge {
|
|
||||||
public:
|
|
||||||
Edge* neighbour = nullptr;
|
|
||||||
};
|
|
@ -1,7 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
class Node;
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "edge.h"
|
|
||||||
#include "corner.h"
|
#include "corner.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
@ -20,7 +22,6 @@ class Node {
|
|||||||
Coords coords;
|
Coords coords;
|
||||||
uint8_t direction;
|
uint8_t direction;
|
||||||
Node* neighbours[CORNERS_PER_PART];
|
Node* neighbours[CORNERS_PER_PART];
|
||||||
Edge* edges[CORNERS_PER_PART];
|
|
||||||
Corner* _corners[CORNERS_PER_PART];
|
Corner* _corners[CORNERS_PER_PART];
|
||||||
Node(uint16_t number, Coords c, uint8_t direction);
|
Node(uint16_t number, Coords c, uint8_t direction);
|
||||||
Node* create_neighbour(uint8_t edge);
|
Node* create_neighbour(uint8_t edge);
|
||||||
|
@ -4,13 +4,11 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "edge.h"
|
|
||||||
#include "corner.h"
|
#include "corner.h"
|
||||||
|
|
||||||
class Node;
|
class Node;
|
||||||
|
|
||||||
extern std::vector<Node*> nodes;
|
extern std::vector<Node*> nodes;
|
||||||
extern std::list<Edge*> edges;
|
|
||||||
extern std::vector<Corner*> corners;
|
extern std::vector<Corner*> corners;
|
||||||
|
|
||||||
extern CRGB leds[LED_COUNT];
|
extern CRGB leds[LED_COUNT];
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
Corner::Corner(Edge* new_e1, Edge* new_e2): e1(new_e1), e2(new_e2) {
|
Corner::Corner(Node* no, uint8_t nu): node(no), number(nu) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "edge.h"
|
|
||||||
#include "corner.h"
|
#include "corner.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "mqtt.h"
|
#include "mqtt.h"
|
||||||
@ -13,7 +12,6 @@
|
|||||||
#include "syslog.h"
|
#include "syslog.h"
|
||||||
|
|
||||||
std::vector<Node*> nodes;
|
std::vector<Node*> nodes;
|
||||||
std::list<Edge*> edges;
|
|
||||||
std::vector<Corner*> corners;
|
std::vector<Corner*> corners;
|
||||||
|
|
||||||
CRGB leds[LED_COUNT];
|
CRGB leds[LED_COUNT];
|
||||||
|
@ -9,7 +9,7 @@ Node::Node(uint16_t number, Coords c, uint8_t _dir) {
|
|||||||
|
|
||||||
LOGln("Created Node #%d at coordinates %d,%d with direction %d.", _number, coords.x, coords.y, direction);
|
LOGln("Created Node #%d at coordinates %d,%d with direction %d.", _number, coords.x, coords.y, direction);
|
||||||
for(int i=0; i<CORNERS_PER_PART; i++) {
|
for(int i=0; i<CORNERS_PER_PART; i++) {
|
||||||
edges[i] = new Edge();
|
neighbours[i] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Corner* last_corner = nullptr;
|
Corner* last_corner = nullptr;
|
||||||
@ -42,9 +42,6 @@ Node* Node::create_neighbour(uint8_t edge) {
|
|||||||
node->neighbours[0] = this;
|
node->neighbours[0] = this;
|
||||||
neighbours[edge] = node;
|
neighbours[edge] = node;
|
||||||
|
|
||||||
node->edges[0]->neighbour = this->edges[edge];
|
|
||||||
this->edges[edge]->neighbour = node->edges[0];
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user