Surface en Z avec ligne de niveau

Surface en Z
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;

P f(double x, double y) {
    return P(x,y,x*x + y*y);
}

int main() {
  
    picture(P(-2,-2),P(2,2), "4x4in");

    begin();

	backing(RGB(0.7,0.7,0.7));

	rgb(0.1,0.2,0.4);
	label(P(0, ymax()), P(0,-4), "\\LARGE$z=x^2+y^2$", b);

	camera.at(P(3,2,2.5));
	camera.look_at(P(0,0,0.7));

	red();

	arrow(P(0,0,0), P(1.75,0,0));
	arrow(P(0,0,0), P(0,1.75,0));
	label(P(1.75,0,0), P(-2,-2), "$x$", bl);
	label(P(0,1.75,0), P(2,-1), "$y$", br);

	fill();
	domain R(P(-1,-1), P(1,1), mesh(40,40), mesh(40,40));

	double niveau  = 0.8;
	double delta   = 0.015;
	
	// Partie basse ( z < niveau )
	clip_face(P(0,0,niveau-delta),P(0,0,-1));
	    rgb(1,0.8,0.2); 
	    surface(f,R,1);
	    red();
	    arrow(P(0,0,0), P(0,0,1.75));
	    label(P(0,0,1.75), P(-2,-2), "$z$", bl);
	    pen(Blue(1.6), "0.5pt");
	    fill(Blue(1.4));
	    surface(f,R,-1);
	clip_restore();
	
	// Bande (z = niveau)
	clip_slice(P(0,0,niveau),P(0,0,1),2*delta);
	    rgb(0.7,0.5,0.2);
	    surface(f,R,1);
	    red();
	    arrow(P(0,0,0), P(0,0,1.75));
	    label(P(0,0,1.75), P(-2,-2), "$z$", bl);
	    pen(Blue(0.7), "0.5pt");
	    fill(Blue(0.7));
	    surface(f,R,-1);
	clip_restore();
	
	// Partie haute (z > niveau)
	clip_face(P(0,0,delta+niveau),P(0,0,1));
	    rgb(1,0.8,0.2);
	    surface(f,R,1);
	    red();
	    arrow(P(0,0,0), P(0,0,1.75));
	    label(P(0,0,1.75), P(-2,-2), "$z$", bl);
	    pen(Blue(1.6), "0.5pt");
	    fill(Blue(1.4));
	    surface(f,R,-1);
	clip_restore();

	pst_format();
    end();
}