Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-4-20250514-thinking-32k· AnthropicHugging Face LMArena Human Preference 140K

generate the code in openscad to render a banana

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-sonnet-4-20250514’s answer.
  1. User

    generate the code in openscad to render a banana

  2. Claude Assistant

    Here's OpenSCAD code to render a banana:

    // Banana parameters
    banana_length = 120;
    banana_width = 25;
    banana_height = 20;
    curve_angle = 45;  // Degrees of curve
    segments = 12;     // Number of segments for smoothness
    
    module banana() {
        hull() {
            for(i = [0:segments]) {
                // Calculate position along the curve
                t = i / segments;
                angle = curve_angle * t;
                
                // Position along curved path
                x = banana_length * t * cos(angle);
                y = banana_length * t * sin(angle);
                z = 0;
                
                // Taper factor - thicker in middle, thinner at ends
                taper = 1 - pow(abs(t - 0.5) * 2, 1.5) * 0.4;
                
                translate([x, y, z])
                scale([taper, taper, taper])
                resize([banana_width, banana_height, banana_width])
                sphere(d=20, $fn=16);
            }
        }
        
        // Add small stem at the end
        translate([banana_length * cos(curve_angle), 
                   banana_length * sin(curve_angle), 
                   0])
        rotate([0, 0, curve_angle])
        translate([5, 0, 0])
        cylinder(h=8, r1=3, r2=1, center=true, $fn=8);
    }
    
    // Render the banana
    banana();
    

    This code creates a banana by:

    1. Curved Path: Uses trigonometric functions to create a natural banana curve
    2. Hull Operation: Connects multiple spheres along the curved path to create a smooth shape
    3. Tapering: Makes the banana thicker in the middle and thinner at the ends using a taper factor
    4. Stem: Adds a small conical stem at the tip

    Key Parameters you can adjust:

    • banana_length: Overall length of the banana
    • banana_width: Width at the thickest point
    • banana_height: Height (thickness) of the banana
    • curve_angle: How much the banana curves (in degrees)
    • segments: Higher values create smoother curves but slower rendering

    The result is a realistic-looking 3D banana that you can 3D print or use in your OpenSCAD projects!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.