fogón

← Basics3D assetfogon/silla-windsor-v5

Silla Windsor

by fogonCC03741 blocks
Silla WindsorDrag to turn it
// «Silla Windsor» · gpt-6-sol (medium)
// Windsor chair («Silla Windsor»). One of several variations of this object: follow the reference picture closely.

const wood = {
  light: "#e9b77d",
  top: "#dda36b",
  grain: "#c88d55",
  edge: "#ad713d",
  shadow: "#86542e",
  spindle: "#b57a43"
};

function timber(x, y, z, base) {
  set(x, y, z, rand() < 0.13 ? wood.grain : base);
}

// Four splayed, turned legs.
for (const sx of [-1, 1]) {
  for (const sy of [-1, 1]) {
    const hipX = 24 + sx * 11;
    const hipY = sy < 0 ? 15 : 33;
    const footX = 24 + sx * 16;
    const footY = sy < 0 ? 10 : 39;

    for (let z = 0; z <= 21; z++) {
      const t = z / 21;
      const cx = Math.round(footX * (1 - t) + hipX * t);
      const cy = Math.round(footY * (1 - t) + hipY * t);
      const width = z >= 16 ? 2 : z >= 4 && z <= 6 ? 2 : 1;
      box(cx, cy, z, cx + width - 1, cy + 1, z,
        z < 3 ? wood.shadow : z % 7 === 0 ? wood.light : wood.edge);
      set(cx, cy - 1, z, z % 7 === 0 ? wood.light : wood.top);
    }

    // Small collars make the legs look turned rather than square posts.
    const collarX = Math.round(footX * 0.42 + hipX * 0.58);
    const collarY = Math.round(footY * 0.42 + hipY * 0.58);
    box(collarX - 1, collarY - 1, 12, collarX + 1, collarY + 1, 13, wood.edge);
    line(collarX - 1, collarY - 1, 13, collarX + 1, collarY - 1, 13, 0, wood.light);
  }
}

// Low stretchers between the legs.
for (const sx of [-1, 1]) {
  line(24 + sx * 14, 12, 9, 24 + sx * 14, 37, 9, 1, wood.edge);
  line(24 + sx * 14, 12, 10, 24 + sx * 14, 37, 10, 0, wood.light);
}
line(10, 12, 8, 38, 12, 8, 1, wood.edge);
line(11, 11, 9, 37, 11, 9, 0, wood.top);
line(10, 37, 8, 38, 37, 8, 1, wood.edge);

// Broad, softly rounded saddle seat.
function seatHalfWidth(y) {
  if (y < 16) return 14 - Math.round((16 - y) * (16 - y) * 0.28);
  if (y > 32) return 14 - Math.round((y - 32) * (y - 32) * 0.38);
  return 14;
}
for (let y = 12; y <= 35; y++) {
  const half = seatHalfWidth(y);
  for (let x = 24 - half; x <= 24 + half; x++) {
    const border = x <= 25 - half || x >= 23 + half || y === 12 || y === 35;
    for (let z = 20; z <= 23; z++) {
      const c = z === 20 ? wood.shadow
        : border ? wood.edge
        : z === 23 ? (rand() < 0.17 ? wood.light : wood.top)
        : wood.grain;
      set(x, y, z, c);
    }

    // Raised perimeter and occasional pale wood-grain marks.
    if (border) {
      set(x, y, 24, rand() < 0.22 ? wood.light : wood.edge);
    } else if (rand() < 0.11 && (x + 2 * y) % 5 < 3) {
      set(x, y, 23, wood.light);
    }
  }
}
line(15, 11, 21, 33, 11, 21, 0, wood.grain);

// Vertical back spindles. Their tops follow the curve of the bow.
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)) - 2;
  for (let z = 25; z <= top; z++) {
    const y = Math.round(35 + 2 * (z - 25) / 18);
    timber(x, y, z, wood.spindle);
    if (z % 8 === 2) set(x, y - 1, z, wood.light);
    if (z > 28 && z < top - 2 && z % 9 === 0)
      set(x, y + 1, z, wood.edge);
  }
}

// Continuous arched Windsor bow, thick at its lower ends.
for (const side of [-1, 1]) {
  for (let z = 24; z <= 28; z++) {
    const x = 24 + side * 14;
    box(x, 35, z, x + 1, 37, z, wood.edge);
    set(x, 34, z, wood.light);
  }
}
let previous = null;
for (let i = 0; i <= 80; i++) {
  const a = Math.PI * i / 80;
  const x = 24 + 14 * Math.cos(a);
  const z = 26 + 17 * Math.sin(a);
  const y = 37 + 2 * Math.sin(a);
  if (previous) {
    line(previous.x, previous.y, previous.z, x, y, z, 1, wood.edge);
    line(previous.x, previous.y - 1, previous.z,
         x, y - 1, z, 0, wood.top);
  }
  previous = { x, y, z };
}
for (let x = 21; x <= 27; x++)
  set(x, 37, 43, wood.light);