Objets nouveaux, pose : arrêt de bus, colocation et potager posés (grille de place libre encadrée), navette sur l'anneau, atelier public de distillation à part, enclos fermé, libre() indexé par cases
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWGVmzHkRQiiivdZYKzLAP
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
34e0727572
commit
cce695b4e9
+104
-76
@@ -110,13 +110,6 @@ function projete(t, x, z) {
|
||||
}
|
||||
return best;
|
||||
}
|
||||
function morceau(t, s0, s1) { // les points du trajet entre deux abscisses, dans le sens de s0 vers s1
|
||||
const pts = [surTrajet(t, s0)].map((p) => [p.x, p.z]);
|
||||
const sens = s1 >= s0 ? 1 : -1;
|
||||
for (let i = 0; i < t.pts.length; i++) if ((t.c[i] - s0) * sens > 0 && (s1 - t.c[i]) * sens > 0) pts.push(t.pts[i]);
|
||||
if (sens < 0) pts.splice(1, pts.length - 1, ...pts.slice(1).reverse());
|
||||
const p = surTrajet(t, s1); pts.push([p.x, p.z]); return pts;
|
||||
}
|
||||
// Un mobile qui roule sur un trajet, sur sa droite (`decal`), à la vitesse `v` ; il ralentit avant chaque arrêt, s'y tient
|
||||
// `p` secondes et repart doucement. En aller-retour (`boucle` faux), chaque bout est un demi-tour ; en boucle, le trajet
|
||||
// recommence (`bouts` : le trajet fait demi-tour sur lui-même à son point de départ, la file se resserre au milieu).
|
||||
@@ -264,41 +257,51 @@ function conserverie(geoP, couleurs) {
|
||||
g.add(quilles(geoP, [[-0.9, 1.5]], couleurs));
|
||||
return g;
|
||||
}
|
||||
// L'alambic (B6), adossé à la conserverie : un chaudron de cuivre sur un foyer de brique, le col de cygne, un fût ; sous un auvent.
|
||||
function alambic() {
|
||||
const g = new THREE.Group(), cu = lam(COUL.cuivre);
|
||||
g.add(mesh(boite(0.95, 0.45, 0.95), lam(COUL.brique), 0, 0.22, 0, true));
|
||||
g.add(mesh(new THREE.SphereGeometry(0.46, 14, 10).scale(1, 0.85, 1), cu, 0, 0.78, 0, true));
|
||||
g.add(mesh(cyl(0.12, 0.35, 10), cu, 0, 1.25, 0));
|
||||
g.add(mesh(new THREE.TorusGeometry(0.42, 0.045, 6, 12, Math.PI).rotateZ(0), cu, 0.42, 1.42, 0));
|
||||
g.add(mesh(new THREE.CylinderGeometry(0.3, 0.3, 0.85, 12), lam(COUL.bois), 0.84, 0.42, 0, true));
|
||||
const mp = lam(COUL.poteau);
|
||||
for (const [x, z] of [[1.35, 0.8], [-0.6, 0.8]]) g.add(mesh(cyl(0.06, 2.3, 6), mp, x, 1.15, z));
|
||||
const auvent = mesh(boite(2.4, 0.07, 2.0), lam(COUL.zinc), 0.37, 2.35, -0.05, true); auvent.rotation.x = 0.12; g.add(auvent);
|
||||
// L'atelier public de distillation (B6, revu le 03/11) : hors Alsace-Moselle, on ne distille pas chez soi (code rural
|
||||
// L664-4 à L664-31, base de connaissances, entrée « Alambic ») ; l'alambic est donc un petit abri communal à part, ni dans
|
||||
// ni contre une maison. Trois murs d'enduit ouverts vers +z, un toit de zinc à un pan ; dedans, le chaudron de cuivre sur
|
||||
// son foyer de brique, le col de cygne vers le serpentin (un fût) ; dehors, des cagettes de fruits qui attendent.
|
||||
function atelierDistillation() {
|
||||
const g = new THREE.Group(), cu = lam(COUL.cuivre), murs = lam(COUL.enduit);
|
||||
g.add(mesh(boite(4.2, 2.5, 0.2), murs, 0, 1.25, -1.5, true));
|
||||
for (const x of [2.0, -2.0]) g.add(mesh(boite(0.2, 2.5, 3.0), murs, x, 1.25, 0, true));
|
||||
const toit = mesh(boite(4.8, 0.1, 3.8), lam(COUL.zinc), 0, 2.72, 0.1, true); toit.rotation.x = 0.14; g.add(toit);
|
||||
g.add(mesh(boite(1.2, 0.55, 1.2), lam(COUL.brique), -0.5, 0.27, -0.4, true));
|
||||
g.add(mesh(new THREE.SphereGeometry(0.6, 14, 10).scale(1, 0.85, 1), cu, -0.5, 0.98, -0.4, true));
|
||||
g.add(mesh(cyl(0.15, 0.45, 10), cu, -0.5, 1.6, -0.4));
|
||||
g.add(mesh(new THREE.TorusGeometry(0.5, 0.055, 6, 12, Math.PI), cu, 0.0, 1.8, -0.4));
|
||||
g.add(mesh(new THREE.CylinderGeometry(0.42, 0.42, 1.1, 12), lam(COUL.bois), 0.5, 0.55, -0.4, true));
|
||||
for (const [x, z, n] of [[2.8, 1.2, 2], [2.8, 0.6, 1], [-2.7, 1.3, 2]]) for (let k = 0; k < n; k++) g.add(mesh(boite(0.58, 0.28, 0.4), MAT.caisse, x, 0.14 + k * 0.29, z, k === 0));
|
||||
return g;
|
||||
}
|
||||
function potagerCommun(geoP, couleurs, verre) {
|
||||
const g = new THREE.Group();
|
||||
g.add(mesh(new THREE.PlaneGeometry(20, 12).rotateX(-Math.PI / 2), lam(COUL.terre), 0, 0.03, 0));
|
||||
// quatre planches, des légumes (instanciés)
|
||||
const terre = lam(COUL.terreF), legs = [];
|
||||
for (const z of [-0.6, 1.3, 3.2, 5.0]) { g.add(mesh(boite(15, 0.16, 1.2), terre, 1.0, 0.1, z)); for (let x = -6.2; x <= 8.2; x += 0.75) for (const dz of [-0.28, 0.28]) legs.push([x + (rnd(x * 3 + z) - 0.5) * 0.2, z + dz]); }
|
||||
// Le potager partagé (L × W, +z vers le sud) : des planches de légumes, la serre commune au fond à droite, la cabane à
|
||||
// outils et le composteur à trois bacs à gauche, quatre jardiniers. La taille suit la place trouvée (20 × 12 m, sinon
|
||||
// 16 × 10, sinon 13 × 8,5 : `objetsNouveaux`) ; la serre garde 8 × 3,8 m tant qu'elle tient.
|
||||
function potagerCommun(geoP, couleurs, verre, L = 20, W = 12) {
|
||||
const g = new THREE.Group(), x0 = -L / 2, z0 = -W / 2;
|
||||
g.add(mesh(new THREE.PlaneGeometry(L, W).rotateX(-Math.PI / 2), lam(COUL.terre), 0, 0.03, 0));
|
||||
const sL = Math.min(8, L * 0.42), sW = Math.min(3.8, W * 0.32);
|
||||
// les planches, des légumes (instanciés) : à droite de la colonne cabane-composteur, devant la serre
|
||||
const terre = lam(COUL.terreF), legs = [], xa = x0 + 3.8, xb = L / 2 - 0.7, zs = [];
|
||||
for (let z = z0 + sW + 1.3; z <= W / 2 - 0.8 + 1e-6; z += 1.85) zs.push(z);
|
||||
for (const z of zs) { g.add(mesh(boite(xb - xa, 0.16, 1.2), terre, (xa + xb) / 2, 0.1, z)); for (let x = xa + 0.4; x <= xb - 0.4; x += 0.75) for (const dz of [-0.28, 0.28]) legs.push([x + (rnd(x * 3 + z) - 0.5) * 0.2, z + dz]); }
|
||||
const C = ['#8aa35f', '#b8714f', '#9db36a', '#cf9c52', '#7d965a', '#c9b05a'];
|
||||
const imL = new THREE.InstancedMesh(new THREE.IcosahedronGeometry(1, 0), lam('#ffffff'), legs.length), M = new THREE.Matrix4(), col = new THREE.Color();
|
||||
legs.forEach(([x, z], i) => { const r = 0.16 + rnd(i * 3) * 0.08; imL.setMatrixAt(i, M.makeScale(r * 1.3, r, r * 1.3).setPosition(x, 0.18 + r * 0.7, z)); imL.setColorAt(i, col.set(C[i % C.length])); });
|
||||
imL.instanceColor.needsUpdate = true; g.add(imL);
|
||||
// la serre commune, 8 × 4 m, en verre, toit à deux pans
|
||||
const serre = new THREE.Group(); serre.position.set(5.5, 0, -3.7);
|
||||
const caisse = mesh(boite(8, 2.2, 3.8), verre, 0, 1.1, 0); caisse.renderOrder = 1; serre.add(caisse);
|
||||
const toitS = mesh(toit2(8, 3.8, 1.2), verre, 0, 2.2, 0); toitS.renderOrder = 1; serre.add(toitS);
|
||||
// la serre commune, en verre, toit à deux pans
|
||||
const serre = new THREE.Group(); serre.position.set(L / 2 - sL / 2 - 0.5, 0, z0 + sW / 2 + 0.4);
|
||||
const caisse = mesh(boite(sL, 2.2, sW), verre, 0, 1.1, 0); caisse.renderOrder = 1; serre.add(caisse);
|
||||
const toitS = mesh(toit2(sL, sW, 1.2), verre, 0, 2.2, 0); toitS.renderOrder = 1; serre.add(toitS);
|
||||
const bord = new THREE.LineBasicMaterial({ color: '#86ada7' });
|
||||
serre.add(new THREE.LineSegments(new THREE.EdgesGeometry(caisse.geometry), bord).translateY(1.1), new THREE.LineSegments(new THREE.EdgesGeometry(toitS.geometry, 20), bord).translateY(2.2));
|
||||
for (let x = -3; x <= 3; x += 1.5) serre.add(mesh(new THREE.IcosahedronGeometry(0.3, 0).scale(1.2, 0.9, 1.2), lam('#9db36a'), x, 0.85, 0.9), mesh(boite(1.2, 0.6, 0.6), lam(COUL.bois), x, 0.3, 0.9));
|
||||
for (let x = -sL / 2 + 1; x <= sL / 2 - 1 + 1e-6; x += 1.5) serre.add(mesh(new THREE.IcosahedronGeometry(0.3, 0).scale(1.2, 0.9, 1.2), lam('#9db36a'), x, 0.85, sW / 2 - 0.9), mesh(boite(1.2, 0.6, 0.6), lam(COUL.bois), x, 0.3, sW / 2 - 0.9));
|
||||
g.add(serre);
|
||||
// la cabane à outils, le composteur à trois bacs
|
||||
const cab = lam(COUL.bois); g.add(mesh(boite(2, 2.0, 2), cab, -8.3, 1.0, -4.3, true), mesh(toit2(2.3, 2.4, 0.7), new THREE.MeshLambertMaterial({ color: '#8a7b6a', side: THREE.DoubleSide, emissive: '#000000' }), -8.3, 2.0, -4.3, true));
|
||||
for (let i = 0; i < 3; i++) { g.add(mesh(boite(1.0, 0.75, 1.0), lam(COUL.poteau), -8.6 + i * 1.08, 0.37, -1.0, true)); g.add(mesh(boite(0.86, 0.04, 0.86), lam(COUL.compost), -8.6 + i * 1.08, 0.76 - i * 0.12, -1.0)); }
|
||||
g.add(quilles(geoP, [[-5.5, 0.35], [2.2, 2.25], [6.0, 4.1], [-3.0, -2.6]], couleurs));
|
||||
const cab = lam(COUL.bois); g.add(mesh(boite(2, 2.0, 2), cab, x0 + 1.3, 1.0, z0 + 1.3, true), mesh(toit2(2.3, 2.4, 0.7), new THREE.MeshLambertMaterial({ color: '#8a7b6a', side: THREE.DoubleSide, emissive: '#000000' }), x0 + 1.3, 2.0, z0 + 1.3, true));
|
||||
for (let i = 0; i < 3; i++) { const z = z0 + 3.4 + i * 1.08; g.add(mesh(boite(1.0, 0.75, 1.0), lam(COUL.poteau), x0 + 1.0, 0.37, z, true)); g.add(mesh(boite(0.86, 0.04, 0.86), lam(COUL.compost), x0 + 1.0, 0.76 - i * 0.12, z)); }
|
||||
const zq = zs.length > 1 ? (zs[0] + zs[1]) / 2 : zs[0] + 0.9;
|
||||
g.add(quilles(geoP, [[x0 + 2.6, z0 + 3.0], [xa + (xb - xa) * 0.3, zq], [xa + (xb - xa) * 0.75, zq], [L / 2 - sL - 0.9, z0 + 1.2]], couleurs));
|
||||
return g;
|
||||
}
|
||||
// Une tiny house (local, longueur le long de x) : rendue par instances, voir `tinies()`.
|
||||
@@ -371,21 +374,35 @@ function chapiteau() {
|
||||
// Rend { anim, maj, cliquables: [{ o, fiche }], points: { id: { x, z, w } }, lumieres: { effet: [matériaux] },
|
||||
// haieOuverte: { k, s0, s1 } | null (la haie qui tombe entre les deux maisons du jardin commun), laisses: [id] }.
|
||||
export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre, matsArbres, tour, convoi }) {
|
||||
const anim = [], maj = [], cliquables = [], points = {}, lumieres = {}, laisses = [], gens = PAL.gens, diag = {};
|
||||
const anim = [], maj = [], cliquables = [], points = {}, lumieres = {}, laisses = [], gens = PAL.gens;
|
||||
const Wx = D.Wm / 2 - 7, Wz = D.Hm / 2 - 7;
|
||||
const coupe = barrieres(D), coupeSansHaie = barrieres({ ...D, haies: [] });
|
||||
const dForet = grilleP(D.arbres.filter((a) => a[4] === 1)), dVie = grilleP([...D.persos, ...D.troupeaux.map((t) => [t[0], t[1]]), ...D.poules.map((p) => [p[0], p[1]])]);
|
||||
const dChemin = grilleP([...D.chemins, ...D.sentiers].flatMap((l) => { const o = []; for (let i = 1; i < l.length; i++) { const L = Math.hypot(l[i][0] - l[i - 1][0], l[i][1] - l[i - 1][1]); for (let s = 0; s < L; s += 2) o.push([l[i - 1][0] + (l[i][0] - l[i - 1][0]) * s / L, l[i - 1][1] + (l[i][1] - l[i - 1][1]) * s / L]); } return o; }), 8);
|
||||
// la place libre, lue sur une grille de 2 m calculée à la demande ; posée, une emprise vide les cases voisines
|
||||
const PAS = 2, memo = new Map(), cle = (i, j) => (i + 2048) * 4096 + j + 2048;
|
||||
// la place libre, lue sur une grille de 2 m calculée à la demande ; posée, une emprise vide les cases voisines. La grille
|
||||
// encadre la valeur vraie (P.libre ne varie pas plus vite que la distance) : au-dessus du seuil par le bas, c'est libre ;
|
||||
// sous le seuil par le haut, c'est pris ; entre les deux (1,4 m au plus), on calcule la valeur vraie. Sans ce calcul, la
|
||||
// grille seule coûtait jusqu'à 1,4 m et laissait de côté l'arrêt de bus, la colocation et le potager (03/11).
|
||||
const PAS = 2, memo = new Map(), fin = new Map(), cle = (i, j) => (i + 2048) * 4096 + j + 2048;
|
||||
const cellule = (i, j) => { const k = cle(i, j); let v = memo.get(k); if (v === undefined) memo.set(k, (v = P.libre(i * PAS, j * PAS))); return v; };
|
||||
const libre = (x, z) => { const i = Math.round(x / PAS), j = Math.round(z / PAS); return Math.min(cellule(i, j) - Math.hypot(x - i * PAS, z - j * PAS), dVie(x, z, 3) - 1.0, dForet(x, z, 4) - 2.0); };
|
||||
const ajoute = (x, z, r) => { P.ajoute(x, z, r); for (let i = Math.floor((x - r - 14) / PAS); i <= Math.ceil((x + r + 14) / PAS); i++) for (let j = Math.floor((z - r - 14) / PAS); j <= Math.ceil((z + r + 14) / PAS); j++) memo.delete(cle(i, j)); };
|
||||
const libre = (x, z, seuil = -Infinity) => {
|
||||
const i = Math.round(x / PAS), j = Math.round(z / PAS), c = cellule(i, j), d = Math.hypot(x - i * PAS, z - j * PAS);
|
||||
let v = c - d >= seuil ? c - d : c + d < seuil ? c + d : null;
|
||||
if (v === null) { // une seconde grille, de 0,5 m (écart 0,35 m au plus), avant la valeur vraie
|
||||
const fi = Math.round(x * 2), fj = Math.round(z * 2), k = cle(fi, fj); let f = fin.get(k);
|
||||
if (f === undefined) fin.set(k, (f = P.libre(fi / 2, fj / 2)));
|
||||
const e = Math.hypot(x - fi / 2, z - fj / 2); v = f - e >= seuil ? f - e : f + e < seuil ? f + e : P.libre(x, z);
|
||||
}
|
||||
return Math.min(v, dVie(x, z, 3) - 1.0, dForet(x, z, 4) - 2.0);
|
||||
};
|
||||
const ajoute = (x, z, r) => { P.ajoute(x, z, r); fin.clear(); for (let i = Math.floor((x - r - 14) / PAS); i <= Math.ceil((x + r + 14) / PAS); i++) for (let j = Math.floor((z - r - 14) / PAS); j <= Math.ceil((z + r + 14) / PAS); j++) memo.delete(cle(i, j)); };
|
||||
// un rectangle (demi-côtés a le long de x local, b le long de z local) tourné de rot : la plus petite place libre dessus
|
||||
const loc = (x, z, rot, u, v) => [x + u * Math.cos(rot) + v * Math.sin(rot), z - u * Math.sin(rot) + v * Math.cos(rot)];
|
||||
function emprise(x, z, rot, a, b, seuil = -Infinity) {
|
||||
// tri rapide : le disque inscrit (rayon min(a, b)) doit être libre ; la grille en donne un majorant au centre
|
||||
{ const i = Math.round(x / PAS), j = Math.round(z / PAS), hi = cellule(i, j) + Math.hypot(x - i * PAS, z - j * PAS) - Math.min(a, b); if (hi < seuil) return hi; }
|
||||
let m = Infinity; const na = Math.max(1, Math.ceil(2 * a / 1.5)), nb = Math.max(1, Math.ceil(2 * b / 1.5));
|
||||
for (let i = 0; i <= na; i++) for (let j = 0; j <= nb; j++) { const [px, pz] = loc(x, z, rot, -a + 2 * a * i / na, -b + 2 * b * j / nb); if (Math.abs(px) > Wx || Math.abs(pz) > Wz) return -9; m = Math.min(m, libre(px, pz)); if (m < seuil) return m; }
|
||||
for (let i = 0; i <= na; i++) for (let j = 0; j <= nb; j++) { const [px, pz] = loc(x, z, rot, -a + 2 * a * i / na, -b + 2 * b * j / nb); if (Math.abs(px) > Wx || Math.abs(pz) > Wz) return -9; m = Math.min(m, libre(px, pz, seuil)); if (m < seuil) return m; }
|
||||
return m;
|
||||
}
|
||||
const occupe = (x, z, rot, a, b) => { const r = Math.min(a, b) * 1.2 + 0.3, l = Math.max(a, b) - Math.min(a, b); const n = Math.max(1, Math.ceil(l / Math.min(a, b)) + 1);
|
||||
@@ -434,10 +451,10 @@ export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre,
|
||||
for (let s = 0; s <= tP.L; s += 1) {
|
||||
const p = surTrajet(tP, s), n = Math.hypot(p.dx, p.dz) || 1, tx = p.dx / n, tz = p.dz / n;
|
||||
if (Math.hypot(p.x - place[0], p.z - place[1]) > 25) continue;
|
||||
for (const cote of [1, -1]) {
|
||||
const nx = -tz * cote, nz = tx * cote, x = p.x + nx * 6.2, z = p.z + nz * 6.2, rot = Math.atan2(-nx, -nz);
|
||||
for (const cote of [1, -1]) for (const off of [6.2, 7.0, 7.8]) {
|
||||
const nx = -tz * cote, nz = tx * cote, x = p.x + nx * off, z = p.z + nz * off, rot = Math.atan2(-nx, -nz);
|
||||
const pl = emprise(x, z, rot, 2.6, 1.1, 0.2); if (pl < 0.2) continue;
|
||||
const score = -4 * vu(x, z, rot, 2.6, 1.1, 2.6) - 0.08 * Math.hypot(x - place[0], z - place[1]) + 0.3 * Math.min(pl, 2) + (nz > 0 ? 0.5 : 0);
|
||||
const score = -4 * vu(x, z, rot, 2.6, 1.1, 2.6) - 0.08 * Math.hypot(x - place[0], z - place[1]) + 0.3 * Math.min(pl, 2) + (nz > 0 ? 0.5 : 0) - 0.3 * (off - 6.2);
|
||||
if (!best || score > best.score) best = { x, z, rot, s, score };
|
||||
}
|
||||
}
|
||||
@@ -463,20 +480,14 @@ export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre,
|
||||
} else laisses.push('fraicheur');
|
||||
}
|
||||
|
||||
// ---- A1. La navette : de l'arrêt de bus, par la route principale et la liaison, un tour de l'anneau, et retour ; elle
|
||||
// s'arrête 5 s à l'arrêt (où elle fait demi-tour) et 5 s au plus près du point fraîcheur
|
||||
if (arret && tr.liaison_anneau && tr.anneau) {
|
||||
const la = tr.liaison_anneau.pts, an = tr.anneau.pts.slice(0, -1);
|
||||
const sJ = projete(tP, la[0][0], la[0][1]).s, s0 = Math.min(tP.L, arret.s + (sJ > arret.s ? 10 : -10));
|
||||
const A = [...morceau(tP, s0, sJ), ...la];
|
||||
const j = an.reduce((m, p, i) => (Math.hypot(p[0] - la[la.length - 1][0], p[1] - la[la.length - 1][1]) < Math.hypot(an[m][0] - la[la.length - 1][0], an[m][1] - la[la.length - 1][1]) ? i : m), 0);
|
||||
const tour = [...an.slice(j), ...an.slice(0, j), an[j]];
|
||||
const pts = [...A, ...tour, ...A.slice().reverse()].filter((p, i, L) => i === 0 || Math.hypot(p[0] - L[i - 1][0], p[1] - L[i - 1][1]) > 0.3);
|
||||
const t = trajet(pts), arrets = [{ s: 0.01, p: 5 }];
|
||||
if (fraicheur) { const q = projete({ ...t, pts: t.pts.slice(0, A.length + tour.length), c: t.c.slice(0, A.length + tour.length) }, fraicheur.x, fraicheur.z); if (q.d < 30) arrets.push({ s: q.s, p: 5 }); }
|
||||
if (arrets.length < 2) arrets.push({ s: t.c[A.length + Math.floor(tour.length / 2)], p: 5 }); // sinon, au milieu du tour de l'anneau
|
||||
// ---- A1. La navette : en boucle sur l'anneau (le défaut du brief), 4,5 m/s, 5 s à deux arrêts : au carrefour de la
|
||||
// liaison et à l'opposé, au bas de la boucle. Elle ne va pas jusqu'à l'arrêt de bus : la seule route qui y mène depuis
|
||||
// l'anneau, `liaison_anneau`, traverse une maison du plan (la n° 11) ; aucune route n'est inventée (03/11).
|
||||
if (tr.anneau) {
|
||||
const t = tr.anneau, la = tr.liaison_anneau?.pts, bout = la ? la[la.length - 1] : t.pts[0];
|
||||
const s1 = projete(t, bout[0], bout[1]).s, s2 = (s1 + t.L / 2) % t.L;
|
||||
const o = navette(); groupe.add(o);
|
||||
const r = roule(o, t, { v: 4.5, decal: 1.8, arrets, boucle: true, bouts: true, depart: 0.3 });
|
||||
const r = roule(o, t, { v: 4.5, decal: 1.8, arrets: [{ s: s1, p: 5 }, { s: s2, p: 5 }], boucle: true, bouts: false, depart: 0.3 });
|
||||
maj.push(r.maj); relie([o], 'quartier-navette', 'navette'); points.navette = r.centre;
|
||||
} else laisses.push('navette');
|
||||
|
||||
@@ -484,7 +495,7 @@ export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre,
|
||||
if (arret) {
|
||||
const o = bus(PAL.autos[1]); groupe.add(o);
|
||||
const r = roule(o, tP, { v: 6, decal: 1.9, arrets: [{ s: arret.s, p: 6 }], depart: 0.15 });
|
||||
maj.push(r.maj); relie([o, ...arret.objs], 'quartier-bus', 'bus'); points.bus = r.centre; points.arret = { x: arret.x, z: arret.z };
|
||||
maj.push(r.maj); relie([o, ...arret.objs], 'quartier-bus', 'bus'); points.bus = r.centre; points.arret = { x: arret.x, z: arret.z, w: 40 };
|
||||
} else laisses.push('bus');
|
||||
|
||||
// ---- A9 (choisi avant les autres maisons). Deux maisons voisines qui font jardin commun : une seule haie entre elles, et
|
||||
@@ -542,8 +553,10 @@ export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre,
|
||||
for (const r of existantes) {
|
||||
if (prises.has(r.i)) continue;
|
||||
const f = r.face, W = f.W; let pl = Infinity;
|
||||
for (let al = -W / 2 + 0.5; al <= W / 2 - 0.5 + 1e-6; al += 1.5) for (const dp of [2.6, 4, 5.5, 7]) pl = Math.min(pl, libre(r.c.x + f.n[0] * (f.d + dp) + f.t[0] * al, r.c.z + f.n[1] * (f.d + dp) + f.t[1] * al));
|
||||
if (pl < 0) continue;
|
||||
// à 3,5 m du mur, la maison elle-même compte pour 1,5 m (son contour est un obstacle de 2 m) : au-dessus de 1,2, rien
|
||||
// d'autre n'est sur la terrasse ; plus loin (portique, bac à sable, étendoir), 0,3 m de marge suffit
|
||||
for (let al = -W / 2 + 0.5; al <= W / 2 - 0.5 + 1e-6; al += 1.5) for (const [dp, m] of [[3.5, 0.9], [4.5, 0], [5.5, 0], [6.6, 0]]) pl = Math.min(pl, libre(r.c.x + f.n[0] * (f.d + dp) + f.t[0] * al, r.c.z + f.n[1] * (f.d + dp) + f.t[1] * al, 0.3 + m) - m);
|
||||
if (pl < 0.3) continue;
|
||||
const fx = r.c.x + f.n[0] * (f.d + 3), fz = r.c.z + f.n[1] * (f.d + 3), vue = P.cache(fx, fz, 2.5, W / 2) + P.cache(r.c.x + f.n[0] * f.d, r.c.z + f.n[1] * f.d, 3, W / 2);
|
||||
const score = -4 * vue + Math.min(pl, 2) + 0.3 * f.n[1] + 0.02 * r.aire;
|
||||
if (!best || score > best.score) best = { r, score };
|
||||
@@ -564,12 +577,12 @@ export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre,
|
||||
// le bac à sable et ses boules de couleur ; l'étendoir et son linge
|
||||
g.add(mesh(boite(1.7, 0.22, 1.7), lam(COUL.sable), -W * 0.3, 0.11, 5.0));
|
||||
['#c8553d', '#e0b04a', '#6f8fa8', '#8aa36a'].forEach((c, i) => g.add(mesh(new THREE.SphereGeometry(0.16, 8, 6), lam(c), -W * 0.3 - 0.4 + i * 0.28, 0.36, 5.0 + (i % 2 ? 0.35 : -0.3))));
|
||||
for (const x of [-1.2, 1.2]) g.add(mesh(cyl(0.04, 1.8, 5), mp, -W * 0.3 + x, 0.9, 7.0));
|
||||
const fil = new THREE.BufferGeometry(); fil.setAttribute('position', new THREE.Float32BufferAttribute([-W * 0.3 - 1.2, 1.7, 7.0, -W * 0.3 + 1.2, 1.7, 7.0], 3));
|
||||
for (const x of [-1.2, 1.2]) g.add(mesh(cyl(0.04, 1.8, 5), mp, -W * 0.3 + x, 0.9, 6.4));
|
||||
const fil = new THREE.BufferGeometry(); fil.setAttribute('position', new THREE.Float32BufferAttribute([-W * 0.3 - 1.2, 1.7, 6.4, -W * 0.3 + 1.2, 1.7, 6.4], 3));
|
||||
g.add(new THREE.LineSegments(fil, new THREE.LineBasicMaterial({ color: '#5c4c3c' })));
|
||||
['#f3eee2', '#c47f5a', '#85adc0', '#e6c96a'].forEach((c, i) => g.add(mesh(boite(0.45, 0.6 - (i % 2) * 0.15, 0.03), lam(c), -W * 0.3 - 0.8 + i * 0.55, 1.38 + (i % 2) * 0.07, 7.0)));
|
||||
['#f3eee2', '#c47f5a', '#85adc0', '#e6c96a'].forEach((c, i) => g.add(mesh(boite(0.45, 0.6 - (i % 2) * 0.15, 0.03), lam(c), -W * 0.3 - 0.8 + i * 0.55, 1.38 + (i % 2) * 0.07, 6.4)));
|
||||
// six adultes et trois enfants
|
||||
g.add(quilles(geoP, [[-W * 0.15 - 0.8, 1.0, 'assis'], [-W * 0.15 + 0.8, 1.0, 'assis'], [-W * 0.15, 2.3, 'assis'], [W * 0.3, 2.0], [W * 0.05, 4.2], [-W * 0.3 + 1.6, 6.3],
|
||||
g.add(quilles(geoP, [[-W * 0.15 - 0.8, 1.0, 'assis'], [-W * 0.15 + 0.8, 1.0, 'assis'], [-W * 0.15, 2.3, 'assis'], [W * 0.3, 2.0], [W * 0.05, 4.2], [-W * 0.3 + 1.6, 5.7],
|
||||
[W * 0.22 - 0.6, 5.2, 'enfant'], [W * 0.22 + 0.6, 5.6, 'enfant'], [-W * 0.3 + 0.4, 4.4, 'enfant']], gens));
|
||||
groupe.add(g); ajoute(g.position.x + f.n[0] * 4.5, g.position.z + f.n[1] * 4.5, W / 2);
|
||||
relie([g], 'quartier-colocation', 'colocation', { x: g.position.x + f.n[0] * 3, z: g.position.z + f.n[1] * 3, w: 44 });
|
||||
@@ -589,29 +602,45 @@ export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre,
|
||||
} else laisses.push('atelier');
|
||||
}
|
||||
|
||||
// ---- A6 et B6. La conserverie et son alambic : sous la bulle « confiture », ou près du grand bâtiment
|
||||
// ---- A6. La conserverie : sous la bulle « confiture », ou près du grand bâtiment. B6. L'atelier public de distillation
|
||||
// (03/11) : à part, à 8-30 m de la conserverie, à 4 m au moins de toute maison (jamais dans ni contre une maison) ; même
|
||||
// fiche, même allumage, le cadrage de la conserverie s'élargit pour les montrer ensemble.
|
||||
{
|
||||
const c = bulle('confiture') || grandPos(D);
|
||||
let best = cherche(c[0], c[1], 26, 4.6, 2.7, 3.6, { rots: [0, 0.25, -0.25] });
|
||||
if (!best) { const g = grandPos(D); best = cherche(g[0], g[1], 40, 4.6, 2.7, 3.6); }
|
||||
if (best) {
|
||||
const g = new THREE.Group(); g.add(conserverie(geoP, gens)); const al = alambic(); al.position.set(-3.6, 0, -0.6); g.add(al);
|
||||
const g = new THREE.Group(); g.add(conserverie(geoP, gens));
|
||||
g.position.x = 0.5; const o = new THREE.Group(); o.add(g); pose(o, best.x, best.z, best.rot); occupe(best.x, best.z, best.rot, 4.6, 2.7);
|
||||
relie([o], 'quartier-conserverie', 'conserverie', { x: best.x, z: best.z, w: 42 });
|
||||
} else laisses.push('conserverie');
|
||||
const loin = (x, z) => { const d = Math.hypot(x - best.x, z - best.z); return d >= 8 && d <= 30 && reps.every((r) => Math.hypot(x - r.c.x, z - r.c.z) > Math.max(r.Lu, r.Lv) / 2 + 4); };
|
||||
const al = cherche(best.x, best.z, 30, 3.3, 2.0, 2.8, { rots: [0, 0.3, -0.3], filtre: loin });
|
||||
const objs = [o]; let point = { x: best.x, z: best.z, w: 42 };
|
||||
if (al) {
|
||||
objs.push(pose(atelierDistillation(), al.x, al.z, al.rot)); occupe(al.x, al.z, al.rot, 3.3, 2.0);
|
||||
point = { x: (best.x + al.x) / 2, z: (best.z + al.z) / 2, w: Math.min(66, Math.max(42, Math.hypot(al.x - best.x, al.z - best.z) + 28)) };
|
||||
} else laisses.push('alambic');
|
||||
relie(objs, 'quartier-conserverie', 'conserverie', point);
|
||||
} else laisses.push('conserverie', 'alambic');
|
||||
}
|
||||
|
||||
// ---- A7. Le potager partagé et la serre commune : la plus grande place libre hors forêt, mare et pâturages, vue
|
||||
// ---- A7. Le potager partagé et la serre commune : la plus grande place libre hors forêt, mare et pâturages (12 m au
|
||||
// moins de tout troupeau), vue ; 20 × 12 m si la place y est, sinon 16 × 10, sinon 13 × 8,5 (le plan est plein : 03/11)
|
||||
{
|
||||
const dTroupeau = grilleP(D.troupeaux.map((t) => [t[0], t[1]]), 8);
|
||||
let best = null;
|
||||
for (const [x, z] of autour(0, 0, 200, 4)) for (const rot of [0, 0.3, -0.3]) {
|
||||
const pl = emprise(x, z, rot, 10.6, 6.6, 0.1); if (pl < 0.1) continue;
|
||||
const score = -3 * vu(x, z, rot, 10.6, 6.6, 2.5) - 0.01 * Math.hypot(x - place[0], z - place[1]) + 0.2 * Math.min(pl, 3);
|
||||
if (!best || score > best.score) best = { x, z, rot, score };
|
||||
for (const [L, W] of [[20, 12], [16, 10], [13, 8.5]]) {
|
||||
const a = L / 2 + 0.6, b = W / 2 + 0.6;
|
||||
for (const [x, z] of autour(0, 0, 200, 4)) for (const rot of [0, 0.3, -0.3, Math.PI / 2]) {
|
||||
if (dTroupeau(x, z, 12 + a) < 12 + a) continue;
|
||||
const pl = emprise(x, z, rot, a, b, 0.1); if (pl < 0.1) continue;
|
||||
const score = -3 * vu(x, z, rot, a, b, 2.5) - 0.01 * Math.hypot(x - place[0], z - place[1]) + 0.2 * Math.min(pl, 3);
|
||||
if (!best || score > best.score) best = { x, z, rot, score, L, W, a, b };
|
||||
}
|
||||
if (best) break;
|
||||
}
|
||||
if (best) {
|
||||
const o = pose(potagerCommun(geoP, gens, verre.clone()), best.x, best.z, best.rot); occupe(best.x, best.z, best.rot, 10.6, 6.6);
|
||||
relie([o], 'vivant-potager', 'potager', { x: best.x, z: best.z, w: 50 });
|
||||
const o = pose(potagerCommun(geoP, gens, verre.clone(), best.L, best.W), best.x, best.z, best.rot); occupe(best.x, best.z, best.rot, best.a, best.b);
|
||||
relie([o], 'vivant-potager', 'potager', { x: best.x, z: best.z, w: Math.max(44, best.L * 2.5) });
|
||||
} else laisses.push('potager');
|
||||
}
|
||||
|
||||
@@ -663,7 +692,8 @@ export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre,
|
||||
// ---- B2. La Rosalie : en boucle sur l'anneau, lentement
|
||||
if (tr.anneau) {
|
||||
const o = rosalie(geoP, gens); groupe.add(o);
|
||||
const r = roule(o, tr.anneau, { v: 2, decal: 1.4, boucle: true, bouts: false, depart: 0.55 });
|
||||
// à contresens de la navette : sur sa droite, elle est dans l'autre voie et ne la croise jamais dans la même
|
||||
const r = roule(o, trajet([...tr.anneau.pts].reverse()), { v: 2, decal: 1.4, boucle: true, bouts: false, depart: 0.55 });
|
||||
maj.push(r.maj); relie([o], 'quartier-rosalie', 'rosalie'); points.rosalie = r.centre;
|
||||
} else laisses.push('rosalie');
|
||||
|
||||
@@ -756,9 +786,7 @@ export function objetsNouveaux({ D, groupe, T, P, maisons, tr, PAL, geoP, verre,
|
||||
} else laisses.push('syntropie');
|
||||
}
|
||||
|
||||
{ const L = []; for (let x = -Wx; x <= Wx; x += 2) for (let z = -Wz; z <= Wz; z += 2) L.push([Math.round(x), Math.round(z), +libre(x, z).toFixed(1)]); L.sort((a, b) => b[2] - a[2]); diag.grands = L.slice(0, 40); diag.place = place;
|
||||
diag.route = []; for (let s = 0; s <= tP.L; s += 3) { const p = surTrajet(tP, s); if (Math.hypot(p.x - place[0], p.z - place[1]) < 30) { const n = Math.hypot(p.dx, p.dz), tx = p.dx / n, tz = p.dz / n; diag.route.push([Math.round(s), [5, 6.2, 8].map((o) => [1, -1].map((c) => +libre(p.x - tz * c * o, p.z + tx * c * o).toFixed(1)))]); } } }
|
||||
return { anim, maj, cliquables, points, lumieres, haieOuverte, laisses, diag };
|
||||
return { anim, maj, cliquables, points, lumieres, haieOuverte, laisses };
|
||||
}
|
||||
|
||||
// les objets du Tour : leur fiche, la largeur de leur cadrage
|
||||
|
||||
Reference in New Issue
Block a user