commit 894fcdc04bd3aad8219ccb2ccdd3969e307a1b48
parent 9d668fe95e14e95f772ba95f5ac6755eaa921f04
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Fri, 20 Jan 2012 14:01:44 +0100
Quelques corrections.
Diffstat:
6 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/geometry/quad.cpp b/geometry/quad.cpp
@@ -225,7 +225,6 @@ Quad Quad::insetProportionnal(float prop) {
Quad rQuad= *this;
Vertex bc = Segment(Segment(c[NW],c[NE]).center(),Segment(c[SW],c[SE]).center()).center();
- prop = prop;
rQuad[NW] = Segment(bc,c[NW]).at(prop);
rQuad[NE] = Segment(bc,c[NE]).at(prop);
diff --git a/geometry/vertex.cpp b/geometry/vertex.cpp
@@ -3,9 +3,8 @@
Vertex::Vertex() {}
Vertex::Vertex(float _x, float _y, float _z): x(_x), y(_y), z(_z) {
- // TODO : DEBUG
- if (!(std::isfinite(x) && std::isfinite(y) && std::isfinite(z)))
- std::cout << "Attempted to create vertex with bad data !" << std::endl;
+ /* if (!(std::isfinite(x) && std::isfinite(y) && std::isfinite(z)))
+ std::cerr << "Attempted to create vertex with bad data !" << std::endl; */
}
float Vertex::norm() const { return std::sqrt(x*x + y*y + z*z); }
diff --git a/rules/arbre.cpp b/rules/arbre.cpp
@@ -51,7 +51,6 @@ void Arbre::triangulation() {
}
void Arbre::getBoundingBoxPoints() {
- // TODO
Vertex u = rotation.u * limitLength() / 2.f;
Vertex l = rotation.l * limitLength() / 2.f;
Quad c(start +u +l, start -u +l, start -u -l, start +u -l);
diff --git a/rules/etage.cpp b/rules/etage.cpp
@@ -28,7 +28,7 @@ void EtageQuad::split() {
Quad wi = w.insetNESW(28, 0, 28, 28);
Quad eih = eh.insetNESW(28, 28, 28, 0);
Quad wih = wh.insetNESW(28, 0, 28, 28);
- // TODO : ArcheQuad(q, q);
+ // TODO : ArcheQuad(Quad, Quad);
addChild(new ArcheQuad(Quad(e[NW], e[SW], w[SE], w[NE]), Segment(qh[NE], q[NE]).length()));
// Mur sur e[N], e[E], e[S], w[S], w[W], w[N];
for (int i = 0; i < 3; i++) {
diff --git a/rules/quartier.cpp b/rules/quartier.cpp
@@ -151,7 +151,7 @@ void QuartierQuad::longueRue() {
addChild(new QuartierQuad(qn));
addChild(new QuartierQuad(qs));
- addChild(new BatimentQuad(Quad(qn[SE], qs[SW], qs[SE], qn[SW]))); // TODO
+ addChild(new BatimentQuad(Quad(qn[SE], qs[SW], qs[SE], qn[SW])));
}
QuartierTri::QuartierTri(Triangle _c) : Chose(), c(_c) {
@@ -201,9 +201,7 @@ void QuartierTri::triangulation() {
}
void QuartierTri::centre() {
- // TODO : maxLength / 6 au lieu de 1000
- // TODO : insetProportionnal();
- Vertex center = c.insetLTR(c.maxLength() / 6).randomPoint(seed, 0);
+ Vertex center = c.insetProportionnal(0.3f).randomPoint(seed, 0);
Vertex edge[3];
for (int i = 0; i < 3; i++)
edge[LEFTSIDE+i] = Segment(c[LEFT+i], c[TOP+i]).randomPos(seed, i+1, 1.f/3.f, 2.f/3.f);
diff --git a/rules/toit.cpp b/rules/toit.cpp
@@ -1,7 +1,5 @@
#include "all_includes.hh"
-// TODO : les x.insetNESW_LTR(x.minLength() / 3.f) sont faux (on risque d'avoir un triangle plus petit qu'⅓), il faudrait une fonction inset qui prend un float entre 0 et 1.
-
ToitQuad::ToitQuad(Quad _c, float _height) : Chose(), c(_c), height(_height) {
addEntropy(c);
}
@@ -28,13 +26,13 @@ void ToitQuad::triangulation() {
void ToitQuad::pointCentral() {
Quad qh = c.offsetNormal(height);
- Vertex center = qh.insetNESW(qh.minLength() / 3.f).randomPoint(seed, 0);
+ Vertex center = qh.insetProportionnal(0.3f).randomPoint(seed, 0);
for (int i = 0; i < 4; i++)
addGPUTriangle(c[SE+i], center, c[NE+i], Couleurs::toit);
}
void ToitQuad::quatrePoints() {
- Quad ch = c.offsetNormal(height).insetNESW(c.minLength() / 3.f); // TODO : insetProportional
+ Quad ch = c.offsetNormal(height).insetProportionnal(0.6f);
addGPUQuad(ch, Couleurs::toit);
for (int i = 0; i < 4; i++)
addGPUQuad(ch[NE+i], c[NE+i], c[SE+i], ch[SE+i], Couleurs::toit);
@@ -120,13 +118,13 @@ void ToitTri::triangulation() {
void ToitTri::pointCentral() {
Triangle th = c.offsetNormal(height);
- Vertex center = th.insetLTR(th.minLength() / 3.f).randomPoint(seed, 0);
+ Vertex center = th.insetProportionnal(0.3f).randomPoint(seed, 0);
for (int i = 0; i < 3; i++)
addGPUTriangle(c[LEFT+i], center, c[TOP+i], Couleurs::toit);
}
void ToitTri::troisPoints() {
- Triangle th = c.offsetNormal(height).insetLTR(c.minLength() / 3.f);
+ Triangle th = c.offsetNormal(height).insetProportionnal(0.6f);
addGPUTriangle(th, Couleurs::toit);
for (int i = 0; i < 3; i++)
addGPUQuad(c[LEFT+i], c[TOP+i], th[TOP+i], th[LEFT+i], Couleurs::toit);
@@ -153,5 +151,5 @@ void ToitTri::deuxPointsVerticaux() {
void ToitTri::plat() {
Triangle ch = c.offsetNormal(Dimensions::hauteurToit * 0.6f);
addGPUThreeQuads(c, ch, Couleurs::toit);
- addGPUTriangle(c, Couleurs::toit);
+ addGPUTriangle(ch, Couleurs::toit);
}