// by Maxim Leyenson // cubic surface branched along astroid double Pi=2*arccos(0); clear_screen; clear_pixmap; width=400; height=400; rot_x= Pi; //rot_y= Pi; //rot_z=Pi/4; color_file_format = jpg; filename="astroidal-surface.jpg"; scale_x = 1/5; // -2 -- +2 scale_y = 1/5; scale_z = 1/5; // ----- transparency module, as in surf manual -------------------------- spec_z = 25.0; perspective=central; transparence=60; transmitted =70; thickness =14; surface_red =255; surface_green=100; surface_blue =130; inside_red =255; inside_green =100; inside_blue =130; // setting light, as in surf documentation illumination=ambient_light+ diffuse_light+ reflected_light+ transmitted_light; ambient=20; smoothness=30; light1_x=1-00; light1_y=100; light1_z=100; light1_vol=80; light3_x=100; light3_y=20; light3_z=50; light3_vol=60; light8_x=-100; light8_y=100; light8_z=-100; light8_vol=0; // ------- the curve ------------------------------ poly a = - 1/(4^(1/3))*(x^2 + y^2 - 1); // looks correct poly b = 27^(1/2) * x*y; // degree 2 poly d = b^2 - 4 * a^3; // degree 6 // astroid is a discriminant of a cubic polynomial poly f = (x^2 + y^2 - 1)^3 + 27 * x^2*y^2; // degree 6 // f = d // curve = d; // draw_curve; // ------- the surface ------------------------------ poly s = z^3 - 3 * a * z + b; surface = s; draw_surface; save_color_image;