fogón

← BásicoObjeto 3Dfogon/silla-windsor-v1

Silla Windsor

de fogonCC03862 bloques
Silla WindsorArrastrá para girarlo
// «Silla Windsor» · gpt-6-sol (medium)
// Windsor chair («Silla Windsor»). One of several variations of this object: follow the reference picture closely.

const wood = "#b8945d";
const light = "#dfbd7d";
const pale = "#edce90";
const mid = "#c8a46b";
const shade = "#947247";
const dark = "#795c39";

function timber(x0, y0, z0, x1, y1, z1, color = wood) {
  box(x0, y0, z0, x1, y1, z1, color);
  for (let x = x0; x <= x1; x++)
    for (let y = y0; y <= y1; y++)
      for (let z = z0; z <= z1; z++) {
        if (rand() < 0.12) set(x, y, z, rand() < 0.5 ? mid : shade);
      }
}

// Four tapered, slightly splayed legs.
for (const xSide of [-1, 1]) {
  for (const ySide of [-1, 1]) {
    const topX = 24 + xSide * 11;
    const topY = 24 + ySide * 9;
    const footX = 24 + xSide * 14;
    const footY = 24 + ySide * 12;
    for (let z = 0; z <= 20; z++) {
      const t = z / 20;
      const x = Math.round(footX * (1 - t) + topX * t);
      const y = Math.round(footY * (1 - t) + topY * t);
      box(x, y, z, x + 1, y + 1, z, z < 7 ? shade : wood);
      set(x, y, z, z < 7 ? mid : light);
    }
  }
}

// Low stretchers visible through the open space beneath the seat.
for (const y of [13, 35]) {
  line(12, y, 9, 37, y, 9, 1, mid);
  line(13, y - 1, 10, 36, y - 1, 10, 0, light);
}
for (const x of [13, 36]) {
  line(x, 13, 8, x, 35, 8, 1, shade);
  line(x, 14, 9, x, 34, 9, 0, mid);
}

// Rounded, solid saddle seat.
function inSeat(x, y) {
  const dx = Math.max(0, Math.abs(x - 24) - 10);
  const dy = Math.max(0, Math.abs(y - 24) - 8);
  return dx * dx + dy * dy <= 18;
}
for (let x = 10; x <= 38; x++) {
  for (let y = 12; y <= 36; y++) {
    if (!inSeat(x, y)) continue;
    for (let z = 19; z <= 22; z++) {
      const edge = !inSeat(x - 1, y) || !inSeat(x + 1, y) ||
                   !inSeat(x, y - 1) || !inSeat(x, y + 1);
      let color = z === 19 ? shade : z === 22 ? pale : mid;
      if (edge) color = z === 22 ? mid : shade;
      else if (z === 22) {
        color = (x % 6 === 0) ? light :
                rand() < 0.16 ? light : pale;
      }
      set(x, y, z, color);
    }
  }
}
// Subtle boards and the raised, rounded seat lip.
for (const x of [16, 22, 28, 34])
  for (let y = 16; y <= 32; y++)
    if (inSeat(x, y)) set(x, y, 22, light);
for (let x = 11; x <= 37; x++)
  for (let y = 12; y <= 36; y++)
    if (inSeat(x, y) && (!inSeat(x, y - 1) || !inSeat(x - 1, y) || !inSeat(x + 1, y)))
      set(x, y, 23, mid);

// Slender vertical Windsor spindles, individually following the arch.
for (const x of [14, 17, 20, 23, 26, 29, 32, 35]) {
  const u = (x - 24) / 14;
  const top = Math.floor(26 + 17 * Math.sqrt(1 - u * u));
  line(x, 35, 23, x, 38, top, 0, shade);
  for (let z = 25; z < top - 1; z += 3) {
    const y = Math.round(35 + (z - 23) * 3 / (top - 23));
    set(x, y - 1, z, mid);
  }
  set(x, 38, top - 1, light);
}

// Continuous bentwood bow: upright sides sweep into a high rounded crown.
for (const x of [10, 38]) {
  line(x, 35, 21, x, 36, 28, 1, shade);
  line(x, 34, 23, x, 35, 29, 0, light);
}
let previous = null;
for (let i = 0; i <= 48; i++) {
  const t = Math.PI * i / 48;
  const x = Math.round(24 + 14 * Math.cos(t));
  const y = Math.round(36 + 2 * Math.sin(t));
  const z = Math.round(27 + 17 * Math.sin(t));
  if (previous) {
    line(previous[0], previous[1], previous[2], x, y, z, 1, wood);
    line(previous[0], previous[1] - 1, previous[2] + 1,
         x, y - 1, z + 1, 0, light);
  }
  previous = [x, y, z];
}
// Slightly wider, flat-grained crest.
box(21, 37, 44, 27, 39, 44, mid);
box(22, 36, 44, 26, 37, 44, light);