Pedir uma mudança

Um erro, uma melhoria ou algo novo. Vão juntos a imagem, o lugar no mapa, a câmera e os últimos erros do console.

A parte da tela que vai com o relato
Nova aba
// ---- street lamps: the city's lighting, on the sidewalk along every street, and their light at night ---- // Brazilian public lighting: a concrete pole on the kerb side of the sidewalk, the lamp on a steel arm out // over the carriageway, about every 35 m (NBR 5101 spaces them three to four times their height); on a // main road a taller pole and a longer arm every 30 m, and on both sides where the road is 12 m or wider, // staggered; a narrow street on one side only, the same all its length. A favela's streets, lit as they // were reached, every 45 m (by the tract, as poorness()). A pole stands only where the sidewalk is (the // sidewalks' polygons), clear of buildings, trees and another pole, never on a bridge. At night each throws // a warm pool of light onto the ground under its lamp. ?lamps=0: none const lamps = (() => { if (!LOOK || new URLSearchParams(initialSearch).get("lamps") === "0") return null; const walkGrid = grid2(streetSidewalks, p => { const c = []; for (let x = p.bb.min.x; x <= p.bb.max.x + 25; x += 25) for (let y = p.bb.min.y; y <= p.bb.max.y + 25; y += 25) c.push([Math.min(x, p.bb.max.x), Math.min(y, p.bb.max.y)]); return c; }); const onWalk = q => [...walkGrid(q)].some(p => p.bb.containsPoint(q) && inside(q, p.rings[0]) && !p.rings.slice(1).some(r => inside(q, r))); const treeGrid = grid2(treePts, t => [[t.x, t.y]], 10); const placed = [], poles = []; const clash = (q, r) => placed.some(o => o.distanceToSquared(q) < r * r); const LIT = new Set(["primary", "primary_link", "secondary", "secondary_link", "tertiary", "tertiary_link", "residential", "living_street", "unclassified", "pedestrian"]); for (const w of ways) { const hwy = w.tags?.highway; if (!LIT.has(hwy) || w.tags.bridge || w.tags.tunnel || w.tags.covered) continue; const pts = w.geometry.map(proj), half = (roadWidth(w) || WIDTH[hwy]) / 2, main = MAIN.has(hwy.replace("_link", "")); const id = w.id >>> 0, both = half >= 6, side = rnd(id, 70) < 0.5 ? 1 : -1; const every = (main ? 30 : 35) * (1 + 0.3 * poorness([pts[Math.floor(pts.length / 2)]])); let at = rnd(id, 71) * every, run = 0, k = 0; for (let i = 1; i < pts.length; i++) { const a = pts[i - 1], b = pts[i], len = a.distanceTo(b); if (len < 0.01) continue; const d = new THREE.Vector2().subVectors(b, a).divideScalar(len), n = new THREE.Vector2(-d.y, d.x); while (at <= run + len) { const c = a.clone().addScaledVector(d, at - run), sides = both ? [k % 2 ? 1 : -1] : [side]; k++; for (const sg of sides) { // out from the centreline to the sidewalk, 45 cm in from the kerb: where the sidewalk really is // the sidewalk's kerb: the first point on it out from the carriageway (OSM's widths are only near // the real ones: a parking lane, a cycle lane), the pole 45 cm in from it let q = null; for (let o = -1; o <= 5 && !q; o += 0.25) { const e = c.clone().addScaledVector(n, sg * (half + o)); if (onWalk(e)) { const f = e.clone().addScaledVector(n, sg * 0.45); q = onWalk(f) ? f : e; } } // no sidewalk mapped (a road along a park, the edge of town): on the verge, 80 cm off the asphalt if (!q) { const e = c.clone().addScaledVector(n, sg * (half + 0.8)); if (elev(e.x, e.y) > 0.5 && !asphaltPolys.some(p => p.bb.containsPoint(e) && inside(e, p.rings[0]) && !p.rings.slice(1).some(r => inside(e, r)))) q = e; } if (!q || clash(q, 14) || [...treeGrid(q)].some(t => t.distanceTo(q) < 1.6)) continue; if (q.x < tNW.x + 1 || q.x > tSE.x - 1 || q.y > tNW.y - 1 || q.y < tSE.y + 1) continue; // past the map's edge, a pole over nothing (REQ-0082) if ((grid.get(`${Math.floor(q.x / CELL)},${Math.floor(q.y / CELL)}`) || []).some(j => inside(q, feet[j]))) continue; placed.push(q); poles.push({ q, out: n.clone().multiplyScalar(-sg), main }); } at += both ? every / 2 : every; } run += len; } } if (!poles.length) return null; // the poles and arms by day: concrete and grey steel, in the plain bucket of their own mesh const b = { pos: [], nrm: [], uv: [], col: [] }, hb = { pos: [], nrm: [], uv: [], col: [] }; const CONCRETE = C("#a8a399"), STEEL = C("#6d7177"), BODY = C("#4a4d52"); const pool = []; for (const { q, out, main } of poles) { const g = elev(q.x, q.y), H = main ? 10 : 8.5, reach = main ? 2.4 : 1.6; const u = out, v = new THREE.Vector2(-out.y, out.x); obox(b, q, u, v, 0.11, 0.11, g - 0.5, g + H, CONCRETE); // the pole const tip = q.clone().addScaledVector(out, reach + 0.1); rod(b, P(q, g + H - 1.3), P(tip, g + H - 0.6), 0.07, STEEL); // the arm, rising over the street obox(hb, tip.clone().addScaledVector(out, 0.25), u, v, 0.32, 0.14, g + H - 0.72, g + H - 0.6, BODY); // the lamp's body pool.push({ c: tip.clone().addScaledVector(out, 0.25), r: H * 2.5 }); } const mesh = (bk, mat) => { const geo = new THREE.BufferGeometry(); geo.setAttribute("position", new THREE.Float32BufferAttribute(bk.pos, 3)); geo.setAttribute("normal", new THREE.Float32BufferAttribute(bk.nrm, 3)); geo.setAttribute("color", new THREE.Float32BufferAttribute(bk.col, 3)); const m = new THREE.Mesh(geo, mat); scene.add(m); return m; }; const poleMesh = mesh(b, new THREE.MeshLambertMaterial({ vertexColors: true })); poleMesh.castShadow = poleMesh.receiveShadow = true; const headMat = new THREE.MeshLambertMaterial({ vertexColors: true, emissive: "#000000" }); mesh(hb, headMat).castShadow = true; // the light on the ground: a grid draped 15 cm over it round each lamp. Light multiplies what it falls on // (lit asphalt stays grey, lit grass green: dst·(1 + light)), and falls off as a lamp's does on a plane, // cos³ of the angle from straight under it, (1 + (d/H)²)^-1.5: half at 0.77 H, a tenth at 1.9 H; gone at 2.5 H const pos = [], uv = [], idx = [], N = 8; for (const { c, r } of pool) { const base = pos.length / 3; for (let j = 0; j <= N; j++) for (let i = 0; i <= N; i++) { const x = c.x + r * (2 * i / N - 1), y = c.y + r * (2 * j / N - 1); pos.push(x, elev(x, y) + 0.15, -y); uv.push(2 * i / N - 1, 2 * j / N - 1); } for (let j = 0; j < N; j++) for (let i = 0; i < N; i++) { const o = base + j * (N + 1) + i; idx.push(o, o + 1, o + N + 2, o, o + N + 2, o + N + 1); } } const pg = new THREE.BufferGeometry(); pg.setAttribute("position", new THREE.Float32BufferAttribute(pos, 3)); pg.setAttribute("uv", new THREE.Float32BufferAttribute(uv, 2)); pg.setIndex(idx); const glow = new THREE.Mesh(pg, new THREE.ShaderMaterial({ uniforms: { uCol: { value: new THREE.Color("#ffc98a") } }, vertexShader: "varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }", fragmentShader: "uniform vec3 uCol; varying vec2 vUv; void main() { float d = length(vUv), x = 2.5 * d; float a = pow(1.0 + x * x, -1.5) * pow(clamp(1.0 - d * d, 0.0, 1.0), 2.0); gl_FragColor = vec4(uCol * a * 7.0, 1.0); }", transparent: true, depthWrite: false, blending: THREE.CustomBlending, blendEquation: THREE.AddEquation, blendSrc: THREE.DstColorFactor, blendDst: THREE.OneFactor, polygonOffset: true, polygonOffsetFactor: -2, polygonOffsetUnits: -2, })); glow.visible = false; glow.renderOrder = 2; scene.add(glow); stats.lamps = poles.length; console.log("[iso3d] street lamps " + poles.length); return { night(v) { glow.visible = v; headMat.emissive.set(v ? "#ffe7b8" : "#000000"); headMat.emissiveIntensity = v ? 2 : 0; } }; })(); lamps?.night(v);