fogón

← Nature3D assetfogon/calas

Calas

by fogonCC06743 blocks
CalasDrag to turn it
// «Calas» · gpt-6-sol (medium)
// A clump of calla lilies: broad green leaves and tall white trumpet-shaped flowers with yellow centers.

// A cheerful clump of calla lilies, rooted at ground level.
ellipsoid(24, 24, 2, 7, 6, 3, "#367d37");
ellipsoid(24, 24, 3, 5, 5, 3, "#439a3e");

// Broad, gently folded leaves radiate from the center.
const leaves = [
  [8, 13, 23, 5.4],
  [7, 31, 17, 5.0],
  [17, 40, 25, 5.6],
  [32, 40, 22, 5.2],
  [42, 30, 21, 5.5],
  [40, 12, 19, 5.0],
  [25, 8, 20, 5.2],
  [13, 25, 28, 4.5],
  [35, 22, 27, 4.4]
];

for (const [ex, ey, ez, maxWidth] of leaves) {
  const sx = 24, sy = 24, sz = 4;
  const dx = ex - sx, dy = ey - sy;
  const length = Math.hypot(dx, dy);
  const px = -dy / length, py = dx / length;

  for (let t = 0.06; t <= 1.001; t += 0.023) {
    const width = maxWidth * Math.pow(Math.sin(Math.PI * t), 0.72);
    for (let side = -width; side <= width; side += 0.45) {
      const fold = 1.6 * (1 - Math.abs(side) / Math.max(width, 0.01));
      const x = sx + dx * t + px * side;
      const y = sy + dy * t + py * side;
      const z = sz + (ez - sz) * t + fold
              - 1.7 * Math.pow(Math.abs(side) / Math.max(width, 0.01), 2);

      set(x, y, z - 2, "#267439");
      set(x, y, z - 1, "#358e40");
      set(x, y, z,
        rand() < 0.16 ? "#79cf54" :
        side > 0 ? "#57ba49" : "#4aa943");
    }
  }

  // Sunlit center rib and short branching veins.
  for (let t = 0.18; t < 0.96; t += 0.025) {
    set(sx + dx * t, sy + dy * t,
        sz + (ez - sz) * t + 2, "#9cda69");
  }
  for (let t = 0.34; t < 0.82; t += 0.17) {
    const w = maxWidth * Math.pow(Math.sin(Math.PI * t), 0.72);
    for (const sign of [-1, 1]) {
      line(
        sx + dx * t, sy + dy * t,
        sz + (ez - sz) * t + 2,
        sx + dx * (t + 0.12) + px * w * 0.72 * sign,
        sy + dy * (t + 0.12) + py * w * 0.72 * sign,
        sz + (ez - sz) * (t + 0.12) + 1,
        0, "#82cd60"
      );
    }
  }
}

// Each bloom has a visible green stalk and a flaring, open white trumpet.
const flowers = [
  [13, 17, 31],
  [24, 25, 39],
  [35, 21, 34],
  [10, 31, 27],
  [40, 32, 29]
];

for (const [cx, cy, cz] of flowers) {
  line(24, 24, 3, cx, cy, cz - 10, 1, "#397e39");
  line(24, 24, 5, cx, cy, cz - 10, 0, "#72bc51");
  ellipsoid(cx, cy, cz - 10, 2, 2, 3, "#4d9842");

  // The front rim dips low; the taller back rim frames the golden center.
  for (let dz = -10; dz <= 4; dz++) {
    const t = (dz + 10) / 14;
    const rx = 1.6 + 4.5 * Math.pow(t, 1.25);
    const ry = 1.4 + 4.4 * Math.pow(t, 1.25);
    for (let dx = -7; dx <= 7; dx++) {
      for (let dy = -7; dy <= 7; dy++) {
        const norm = (dx * dx) / (rx * rx) + (dy * dy) / (ry * ry);
        if (norm > 1.05) continue;

        const frontLimit = dy < -0.6
          ? -1 - 4.2 * Math.min(1, (-dy - 0.6) / ry)
          : 4;
        if (dz > frontLimit) continue;

        const hollow = dz > -7 && norm < Math.pow(
          Math.max(0.12, 1 - 1.45 / Math.max(rx, ry)), 2
        );
        if (hollow) continue;

        let color;
        if (norm < 0.77 && dy > 0) color = "#f2e9ce";
        else if (dy < -1) color = "#fffdf0";
        else if (dx < 0) color = "#ffffff";
        else color = "#e5e9dd";
        if (dz < -7) color = "#dce5cc";
        set(cx + dx, cy + dy, cz + dz, color);
      }
    }
  }

  // Thick rolled lip and the bright yellow spadix inside the opening.
  for (let dx = -5; dx <= 5; dx++) {
    const dy = Math.round(-Math.sqrt(Math.max(0, 25 - dx * dx)));
    set(cx + dx, cy + dy, cz - 5, "#ffffff");
  }
  ellipsoid(cx, cy - 1, cz - 2, 2, 2, 3, "#f8ce39");
  cylinder(cx, cy - 2, cz - 3, 1, 6, "#ffd94b");
  sphere(cx, cy - 2, cz + 2, 1.4, "#ffe477");
  for (let i = 0; i < 9; i++) {
    const a = i * 2.4;
    set(cx + Math.round(Math.cos(a)),
        cy - 2 + Math.round(Math.sin(a)),
        cz - 2 + (i % 5), "#e9ab2c");
  }
}