Deux trois trucs sur la décomposition des constructions, suite au

prochain épisode.
This commit is contained in:
Yoann 2011-12-12 23:15:24 +01:00
parent 08c2ba0e0d
commit 45e89f2649
8 changed files with 17 additions and 3 deletions

View File

@ -9,7 +9,7 @@ Quad::Quad(Vertex ne, Vertex se, Vertex sw, Vertex nw) {
corner[NW] = nw;
}
void Quad::offset(/*Cardinal*/int side, int offset) {
void Quad::offset(Cardinal side, int offset) {
Vertex voffset = (corner[NE + side]-corner[NW + side]).perpendicular().setNorm(offset);
corner[NE + side] = corner[NE + side] + voffset.projectOn(corner[NE + side]-corner[SE + side]);
corner[NW + side] = corner[NW + side] + voffset.projectOn(corner[NW + side]-corner[SW + side]);

View File

@ -10,7 +10,7 @@ public:
public:
Quad();
Quad(Vertex ne, Vertex se, Vertex sw, Vertex nw);
void offset(/*Cardinal*/int side, int offset);
void offset(Cardinal side, int offset);
int minLengthNS();
int minLengthEW();
int maxLengthNS();

View File

@ -10,8 +10,21 @@ int BatimentQuad::width() { return this->ne.x - this->sw.x; }
int BatimentQuad::height() { return this->ne.y - this->sw.y; }
bool BatimentQuad::subdivide() {
// TODO : rien ?
return true;
}
Chose* BatimentQuad::factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw) {
return false;
Quad q = Quad(ne,se,sw,nw);
seed = seed;
n = n;
q.offset(N,20);
q.offset(E,20);
q.offset(S,20);
q.offset(W,20);
return NULL; // pour compilation, à virer.
}
void BatimentQuad::triangulation() {

View File

@ -19,6 +19,7 @@ public:
int height();
virtual bool subdivide();
virtual void triangulation();
Chose* factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw);
};
#endif

View File

View File

View File

View File