fogón

← Basics3D assetfogon/tajada-de-sandia

Tajada de sandía

by fogonCC016058 blocks
Tajada de sandíaDrag to turn it
// «Tajada de sandía» · gpt-6-sol (medium)
// Watermelon wedge («Tajada de sandía»).

// A thick triangular watermelon wedge, with its seeded cut face toward -y.
const front = 13, back = 30;
const seeds = [
  [12, 12], [15, 16], [18, 21], [19, 12],
  [22, 17], [24, 25], [26, 32], [28, 14],
  [29, 21], [30, 27], [33, 15], [34, 21],
  [37, 12], [25, 11]
];

for (let x = 5; x <= 43; x++) {
  const dx = x - 24;
  const bottom = Math.round(0.0105 * dx * dx); // Center touches the floor at z=0.
  const top = Math.floor(40 - 1.68 * Math.abs(dx));

  for (let y = front; y <= back; y++) {
    for (let z = bottom; z <= top; z++) {
      const layer = z - bottom;
      const face = y === front;
      let color;

      if (layer === 0) {
        color = face ? "#195b32" : "#246b38";
      } else if (layer === 1) {
        color = face ? "#287c3c" : "#378d43";
      } else if (layer === 2) {
        color = "#63a64f";
      } else if (layer === 3) {
        color = "#e5dca0";
      } else if (layer === 4) {
        color = "#f1dda2";
      } else {
        color = face ? "#df5558" : "#cf424b";

        // Stepped red striations along the left sloping edge.
        if (z === top && x < 24) {
          color = x % 2 === 0 ? "#a82c3c" : "#eb5960";
          if (y === front || y === back) color = "#ec6970";
        } else if (z === top) {
          color = "#e66165";
        } else if (z >= top - 1 && x < 24 && !face) {
          color = x % 2 === 0 ? "#a93240" : "#d84a53";
        } else if (face) {
          if (rand() < 0.065) color = "#d14a50";
          else if (rand() < 0.035) color = "#eb6567";
        } else if (rand() < 0.025) {
          color = "#db4b52";
        }
      }
      set(x, y, z, color);
    }
  }
}

// Dark, tapered seeds stand slightly proud of the front cut surface.
for (const [x, z] of seeds) {
  if (get(x, front, z) && get(x, front, z + 1)) {
    set(x, front - 1, z, "#392b2b");
    set(x, front - 1, z + 1, "#322629");
    if (get(x, front, z + 2)) set(x, front - 1, z + 2, "#563039");
    set(x + 1, front - 1, z, "#a83d43");
  }
}