Quelques corrections.
This commit is contained in:
parent
9d668fe95e
commit
894fcdc04b
|
@ -225,7 +225,6 @@ Quad Quad::insetProportionnal(float prop) {
|
||||||
Quad rQuad= *this;
|
Quad rQuad= *this;
|
||||||
|
|
||||||
Vertex bc = Segment(Segment(c[NW],c[NE]).center(),Segment(c[SW],c[SE]).center()).center();
|
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[NW] = Segment(bc,c[NW]).at(prop);
|
||||||
rQuad[NE] = Segment(bc,c[NE]).at(prop);
|
rQuad[NE] = Segment(bc,c[NE]).at(prop);
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
Vertex::Vertex() {}
|
Vertex::Vertex() {}
|
||||||
|
|
||||||
Vertex::Vertex(float _x, float _y, float _z): x(_x), y(_y), z(_z) {
|
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)))
|
||||||
if (!(std::isfinite(x) && std::isfinite(y) && std::isfinite(z)))
|
std::cerr << "Attempted to create vertex with bad data !" << std::endl; */
|
||||||
std::cout << "Attempted to create vertex with bad data !" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Vertex::norm() const { return std::sqrt(x*x + y*y + z*z); }
|
float Vertex::norm() const { return std::sqrt(x*x + y*y + z*z); }
|
||||||
|
|
|
@ -51,7 +51,6 @@ void Arbre::triangulation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Arbre::getBoundingBoxPoints() {
|
void Arbre::getBoundingBoxPoints() {
|
||||||
// TODO
|
|
||||||
Vertex u = rotation.u * limitLength() / 2.f;
|
Vertex u = rotation.u * limitLength() / 2.f;
|
||||||
Vertex l = rotation.l * limitLength() / 2.f;
|
Vertex l = rotation.l * limitLength() / 2.f;
|
||||||
Quad c(start +u +l, start -u +l, start -u -l, start +u -l);
|
Quad c(start +u +l, start -u +l, start -u -l, start +u -l);
|
||||||
|
|
|
@ -28,7 +28,7 @@ void EtageQuad::split() {
|
||||||
Quad wi = w.insetNESW(28, 0, 28, 28);
|
Quad wi = w.insetNESW(28, 0, 28, 28);
|
||||||
Quad eih = eh.insetNESW(28, 28, 28, 0);
|
Quad eih = eh.insetNESW(28, 28, 28, 0);
|
||||||
Quad wih = wh.insetNESW(28, 0, 28, 28);
|
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()));
|
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];
|
// Mur sur e[N], e[E], e[S], w[S], w[W], w[N];
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
|
|
@ -151,7 +151,7 @@ void QuartierQuad::longueRue() {
|
||||||
|
|
||||||
addChild(new QuartierQuad(qn));
|
addChild(new QuartierQuad(qn));
|
||||||
addChild(new QuartierQuad(qs));
|
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) {
|
QuartierTri::QuartierTri(Triangle _c) : Chose(), c(_c) {
|
||||||
|
@ -201,9 +201,7 @@ void QuartierTri::triangulation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuartierTri::centre() {
|
void QuartierTri::centre() {
|
||||||
// TODO : maxLength / 6 au lieu de 1000
|
Vertex center = c.insetProportionnal(0.3f).randomPoint(seed, 0);
|
||||||
// TODO : insetProportionnal();
|
|
||||||
Vertex center = c.insetLTR(c.maxLength() / 6).randomPoint(seed, 0);
|
|
||||||
Vertex edge[3];
|
Vertex edge[3];
|
||||||
for (int i = 0; i < 3; i++)
|
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);
|
edge[LEFTSIDE+i] = Segment(c[LEFT+i], c[TOP+i]).randomPos(seed, i+1, 1.f/3.f, 2.f/3.f);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "all_includes.hh"
|
#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) {
|
ToitQuad::ToitQuad(Quad _c, float _height) : Chose(), c(_c), height(_height) {
|
||||||
addEntropy(c);
|
addEntropy(c);
|
||||||
}
|
}
|
||||||
|
@ -28,13 +26,13 @@ void ToitQuad::triangulation() {
|
||||||
|
|
||||||
void ToitQuad::pointCentral() {
|
void ToitQuad::pointCentral() {
|
||||||
Quad qh = c.offsetNormal(height);
|
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++)
|
for (int i = 0; i < 4; i++)
|
||||||
addGPUTriangle(c[SE+i], center, c[NE+i], Couleurs::toit);
|
addGPUTriangle(c[SE+i], center, c[NE+i], Couleurs::toit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToitQuad::quatrePoints() {
|
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);
|
addGPUQuad(ch, Couleurs::toit);
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
addGPUQuad(ch[NE+i], c[NE+i], c[SE+i], ch[SE+i], Couleurs::toit);
|
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() {
|
void ToitTri::pointCentral() {
|
||||||
Triangle th = c.offsetNormal(height);
|
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++)
|
for (int i = 0; i < 3; i++)
|
||||||
addGPUTriangle(c[LEFT+i], center, c[TOP+i], Couleurs::toit);
|
addGPUTriangle(c[LEFT+i], center, c[TOP+i], Couleurs::toit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToitTri::troisPoints() {
|
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);
|
addGPUTriangle(th, Couleurs::toit);
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
addGPUQuad(c[LEFT+i], c[TOP+i], th[TOP+i], th[LEFT+i], Couleurs::toit);
|
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() {
|
void ToitTri::plat() {
|
||||||
Triangle ch = c.offsetNormal(Dimensions::hauteurToit * 0.6f);
|
Triangle ch = c.offsetNormal(Dimensions::hauteurToit * 0.6f);
|
||||||
addGPUThreeQuads(c, ch, Couleurs::toit);
|
addGPUThreeQuads(c, ch, Couleurs::toit);
|
||||||
addGPUTriangle(c, Couleurs::toit);
|
addGPUTriangle(ch, Couleurs::toit);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user