worked on floorplan (v2)

worked on grid-generation (v2)
new helper methods for geometry
new test cases
This commit is contained in:
2016-07-13 19:11:18 +02:00
parent cc21cbb0ea
commit 34e52cd7f0
26 changed files with 2083 additions and 272 deletions

View File

@@ -21,15 +21,26 @@ private:
/** grant full access to the grid */
template<typename> friend class Grid;
/** INTERNAL: array-index */
/** INTERNAL: node's index array-index */
int _idx;
/** semantic annotation for this node */
uint8_t _type;
/** INTERNAL: number of neighbors */
int _numNeighbors;
uint8_t _numNeighbors;
/** INTERNAL: store neighbors (via index) */
int _neighbors[10];
public:
static const uint8_t TYPE_FLOOR = 0;
static const uint8_t TYPE_STAIR = 1;
static const uint8_t TYPE_ELEVATOR = 2;
static const uint8_t TYPE_DOOR = 3;
public:
GridNode() : _idx(-1), _numNeighbors(0), _neighbors() {;}
@@ -40,6 +51,23 @@ public:
/** get the number of neighbors for this node */
int getNumNeighbors() const {return _numNeighbors;}
/** reached neighbor limit? */
bool fullyConnected() const {return _numNeighbors >= 10;}
/** is this node connected to the given index? */
bool hasNeighbor(const int idx) const {
for (int i = 0; i < _numNeighbors; ++i) {
if (_neighbors[i] == idx) {return true;}
}
return false;
}
/** get the node's semantic type */
uint8_t getType() const {return _type;}
/** set the node's semantic type */
void setType(const uint8_t type) {this->_type = type;}
// /** get the n-th neighbor for this node */
// template <int gridSize_cm, typename T> inline T& getNeighbor(const int nth, const Grid<gridSize_cm, T>& grid) const {
// return grid.getNeighbor(_idx, nth);