2011-m2s3-city-builder/rules/chose.hh
2011-12-20 15:42:52 +01:00

57 lines
1.5 KiB
C++

#ifndef _RULES_CHOSE_HH_
#define _RULES_CHOSE_HH_
#include "all_includes.hh"
// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°.
class Chose {
public :
static unsigned int initialSeed;
unsigned int seed;
std::vector<Chose*> children;
std::vector<Triangle*> triangles;
LodNode lod;
int inCounter;
int splitCube[6];
int mergeCube[6];
Vertex lctr; // Local center;
public :
void display();
virtual bool split() = 0;
virtual bool merge();
protected :
Chose();
inline void addEntropy(unsigned int x1) {
seed = hash2(seed, x1);
}
inline void addEntropy(unsigned int x1, unsigned int x2) {
addEntropy(x1); addEntropy(x2);
}
inline void addEntropy(unsigned int x1, unsigned int x2, unsigned int x3) {
addEntropy(x1, x2); addEntropy(x3);
}
inline void addEntropy(unsigned int x1, unsigned int x2, unsigned int x3, unsigned int x4) {
addEntropy(x1, x2); addEntropy(x3, x4);
}
inline void addEntropy(Vertex v1) {
addEntropy(v1.x, v1.y);
}
inline void addEntropy(Vertex v1, Vertex v2) {
addEntropy(v1); addEntropy(v2);
}
inline void addEntropy(Vertex v1, Vertex v2, Vertex v3) {
addEntropy(v1, v2); addEntropy(v3);
}
inline void addEntropy(Vertex v1, Vertex v2, Vertex v3, Vertex v4) {
addEntropy(v1, v2); addEntropy(v3, v4);
}
void addChild(Chose* c);
void addTriangle(Triangle* t);
virtual void triangulation() = 0;
virtual std::vector<Vertex*> getBoundingBoxPoints() const = 0;
};
#endif