Ajout de la méthode de récupération des listes de sommets pertinents
pour la création de la bouding box finale.
This commit is contained in:
parent
61ad0a6503
commit
bf7ecfa18a
|
@ -10,6 +10,11 @@ int BatimentQuad::width() { return this->ne.x - this->sw.x; }
|
|||
|
||||
int BatimentQuad::height() { return this->ne.y - this->sw.y; }
|
||||
|
||||
std::vector<Vertex*> BatimentQuad::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
bool BatimentQuad::subdivide() {
|
||||
factory(1,1,ne,se,sw,nw);
|
||||
return true;
|
||||
|
|
|
@ -22,6 +22,7 @@ class BatimentQuad : public Chose {
|
|||
virtual bool subdivide();
|
||||
virtual void triangulation();
|
||||
Chose* factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,11 @@ int BatimentQuadJardin::width() { return this->ne.x - this->sw.x; }
|
|||
|
||||
int BatimentQuadJardin::height() { return this->ne.y - this->sw.y; }
|
||||
|
||||
std::vector<Vertex*> BatimentQuadJardin::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
bool BatimentQuadJardin::subdivide() {
|
||||
|
||||
return true;
|
||||
|
|
|
@ -21,6 +21,7 @@ class BatimentQuadJardin : public Chose {
|
|||
virtual bool subdivide();
|
||||
virtual void triangulation();
|
||||
Chose* factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,11 @@ int BatimentQuadMaison::width() { return this->ne.x - this->sw.x; }
|
|||
|
||||
int BatimentQuadMaison::height() { return this->ne.y - this->sw.y; }
|
||||
|
||||
std::vector<Vertex*> BatimentQuadMaison::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
bool BatimentQuadMaison::subdivide() {
|
||||
|
||||
return true;
|
||||
|
|
|
@ -21,6 +21,7 @@ class BatimentQuadMaison : public Chose {
|
|||
virtual bool subdivide();
|
||||
virtual void triangulation();
|
||||
Chose* factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,7 @@ class Chose {
|
|||
void addChild(Chose* c);
|
||||
void addTriangle(Triangle* t);
|
||||
virtual void triangulation() = 0;
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -8,6 +8,11 @@ QuartierQuad::QuartierQuad(Vertex ne, Vertex se, Vertex sw, Vertex nw) : Chose()
|
|||
corner[NW] = nw;
|
||||
}
|
||||
|
||||
std::vector<Vertex*> QuartierQuad::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
Chose* QuartierQuad::factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw) {
|
||||
Quad q = Quad(ne,se,sw,nw);
|
||||
bool small = q.minLength() < 2500;
|
||||
|
|
|
@ -12,6 +12,7 @@ public:
|
|||
virtual bool subdivide();
|
||||
virtual void triangulation();
|
||||
static Chose* factory(int seed, int n, Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,6 +4,11 @@ QuartierQuadAngle::QuartierQuadAngle(Vertex ne, Vertex se, Vertex sw, Vertex nw)
|
|||
triangulation();
|
||||
}
|
||||
|
||||
std::vector<Vertex*> QuartierQuadAngle::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
bool QuartierQuadAngle::subdivide() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (Triangle(corner[NW+i], corner[NE+i], corner[SE+i]).angle() >= Angle::d2r(130)) {
|
||||
|
|
|
@ -5,12 +5,15 @@
|
|||
|
||||
// QuadAngle est un quadrilatère avec des angles malfichus (< 90-40 ou > 90+40).
|
||||
class QuartierQuadAngle : public QuartierQuad {
|
||||
private:
|
||||
private :
|
||||
static const int hrw = 150; // half road width : 2,50m.
|
||||
public:
|
||||
|
||||
public :
|
||||
QuartierQuadAngle(Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
virtual bool subdivide();
|
||||
private:
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
|
||||
private :
|
||||
void cutAngle();
|
||||
};
|
||||
|
||||
|
|
|
@ -3,10 +3,15 @@
|
|||
QuartierQuadCarre::QuartierQuadCarre(Vertex ne, Vertex se, Vertex sw, Vertex nw) : QuartierQuad(ne, se, sw, nw) {
|
||||
}
|
||||
|
||||
std::vector<Vertex*> QuartierQuadCarre::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
bool QuartierQuadCarre::subdivide() {
|
||||
Vertex middle[4];
|
||||
Quad q[4];
|
||||
|
||||
|
||||
Vertex cn = Segment(corner[NW], corner[NE]).randomPos(seed, -1, 25, 75);
|
||||
Vertex cs = Segment(corner[SE], corner[SW]).randomPos(seed, -2, 25, 75);
|
||||
Vertex c = Segment(cn, cs).randomPos(seed, -3, 25, 75);
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
|
||||
// Quad est un quadrilatère
|
||||
class QuartierQuadCarre : public QuartierQuad {
|
||||
private:
|
||||
private :
|
||||
static const int hrw = 250; // half road width : 2,50m.
|
||||
public:
|
||||
|
||||
public :
|
||||
QuartierQuadCarre(Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
virtual bool subdivide();
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
QuartierQuadRect::QuartierQuadRect(Vertex ne, Vertex se, Vertex sw, Vertex nw) : QuartierQuad(ne, se, sw, nw) {
|
||||
}
|
||||
|
||||
std::vector<Vertex*> QuartierQuadRect::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
bool QuartierQuadRect::subdivide() {
|
||||
Vertex n = Segment(corner[NW], corner[NE]).randomPos(seed, 0, 33, 67);
|
||||
Vertex s = Segment(corner[SE], corner[SW]).randomPos(seed, 1, 33, 67);
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
|
||||
// Quad est un quadrilatère
|
||||
class QuartierQuadRect : public QuartierQuad {
|
||||
private:
|
||||
private :
|
||||
static const int hrw = 250; // half road width : 2,50m.
|
||||
public:
|
||||
|
||||
public :
|
||||
QuartierQuadRect(Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
virtual bool subdivide();
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,11 @@ QuartierTri::QuartierTri(Vertex left, Vertex top, Vertex right) : Chose() {
|
|||
triangulation();
|
||||
}
|
||||
|
||||
std::vector<Vertex*> QuartierTri::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
Chose* QuartierTri::factory(int seed, int n, Vertex left, Vertex top, Vertex right) {
|
||||
(void)seed;
|
||||
(void)n;
|
||||
|
|
|
@ -5,13 +5,15 @@
|
|||
|
||||
// RectangleRoutes est un quadrilatère de routes avec des angles aux coins égaux à 90°.
|
||||
class QuartierTri : public Chose {
|
||||
public:
|
||||
public :
|
||||
Vertex corner[3];
|
||||
public:
|
||||
|
||||
public :
|
||||
QuartierTri(Vertex left, Vertex top, Vertex right);
|
||||
virtual bool subdivide();
|
||||
virtual void triangulation();
|
||||
static Chose* factory(int seed, int n, Vertex left, Vertex top, Vertex right);
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,6 +5,11 @@ RouteQuadCarrefour::RouteQuadCarrefour(Vertex ne, Vertex se, Vertex sw, Vertex n
|
|||
triangulation();
|
||||
}
|
||||
|
||||
std::vector<Vertex*> RouteQuadCarrefour::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
bool RouteQuadCarrefour::subdivide() {
|
||||
// TODO
|
||||
return false;
|
||||
|
|
|
@ -14,6 +14,7 @@ class RouteQuadCarrefour : public Chose {
|
|||
RouteQuadCarrefour(Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
virtual bool subdivide();
|
||||
virtual void triangulation();
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,6 +4,11 @@ RouteQuadChaussee::RouteQuadChaussee(Vertex ne, Vertex se, Vertex sw, Vertex nw)
|
|||
triangulation();
|
||||
}
|
||||
|
||||
std::vector<Vertex*> RouteQuadChaussee::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
bool RouteQuadChaussee::subdivide() {
|
||||
// TODO
|
||||
return false;
|
||||
|
@ -19,12 +24,12 @@ void RouteQuadChaussee::triangulation() {
|
|||
/*void RouteQuadChaussee::triangulation() {
|
||||
triangles.reserve(2);
|
||||
Vertex nne, nnw, nse, nsw; // Nouvel emplacement de la route.
|
||||
|
||||
|
||||
nnw = nw + ((ne - nw)/6);
|
||||
nsw = sw + ((se - sw)/6);
|
||||
nne = ne - ((ne - nw)/6);
|
||||
nse = se - ((se - sw)/6);
|
||||
|
||||
|
||||
addChild(new TrottoirRoute(nnw, nsw, sw, nw, 20));
|
||||
addChild(new TrottoirRoute(ne, se, nse, nne,20));
|
||||
}*/
|
||||
|
|
|
@ -14,6 +14,7 @@ class RouteQuadChaussee : public Chose {
|
|||
RouteQuadChaussee(Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
virtual bool subdivide();
|
||||
virtual void triangulation();
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,11 @@ TrottoirQuadNormal::TrottoirQuadNormal(Vertex ne, Vertex se, Vertex sw, Vertex n
|
|||
triangulation();
|
||||
}
|
||||
|
||||
std::vector<Vertex*> TrottoirQuadNormal::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
bool TrottoirQuadNormal::subdivide() {
|
||||
// TODO
|
||||
return false;
|
||||
|
|
|
@ -16,6 +16,7 @@ class TrottoirQuadNormal : public Chose {
|
|||
TrottoirQuadNormal(Vertex ne, Vertex se, Vertex sw, Vertex nw, int height, Cardinal border);
|
||||
virtual bool subdivide();
|
||||
virtual void triangulation();
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,11 @@ TerrainQuadHerbe::TerrainQuadHerbe(Vertex ne, Vertex se, Vertex sw, Vertex nw) :
|
|||
triangulation();
|
||||
}
|
||||
|
||||
std::vector<Vertex*> TerrainQuadHerbe::getBoundingBoxPoints() const {
|
||||
std::vector<Vertex*> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
TerrainQuadHerbe::TerrainQuadHerbe(int red, Vertex ne, Vertex se, Vertex sw, Vertex nw) : Chose(), red(red) {
|
||||
addEntropy(ne, se, sw, nw);
|
||||
corner[NE] = ne;
|
||||
|
|
|
@ -5,14 +5,16 @@
|
|||
|
||||
// Quad est un quadrilatère
|
||||
class TerrainQuadHerbe : public Chose {
|
||||
private:
|
||||
private :
|
||||
Vertex corner[4];
|
||||
int red; // DEBUG
|
||||
public:
|
||||
|
||||
public :
|
||||
TerrainQuadHerbe(Vertex ne, Vertex se, Vertex sw, Vertex nw);
|
||||
TerrainQuadHerbe(int red, Vertex ne, Vertex se, Vertex sw, Vertex nw); // DEBUG
|
||||
virtual bool subdivide();
|
||||
virtual void triangulation();
|
||||
virtual std::vector<Vertex*> getBoundingBoxPoints() const;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user