1// Schwartz "P" surface: 2// https://en.wikipedia.org/wiki/Schwarz_minimal_surface#Schwarz_P_.28.22Primitive.22.29 3 4let 5 schwartz_p = make_shape { 6 dist p = -(cos(p.[X]) + cos(p.[Y]) + cos(p.[Z])); 7 is_3d = true; 8 }; 9 10 schwartz_bones = schwartz_p >> offset (-1) >> lipschitz 2; 11 schwartz_bones2 = complement schwartz_p >> offset (-1) >> lipschitz 2; 12 double_schwartz_bones = union [ 13 colour blue schwartz_bones, 14 colour green schwartz_bones2, 15 ]; 16 17 schwartz_surface = shell (.2) schwartz_p >> lipschitz 2; 18 19 schwartzize t shape = morph t [shape, intersection[shape, schwartz_surface]]; 20 21in 22row 5 [ 23 schwartz_surface `intersection` sphere(tau*3), 24 schwartz_surface >> colour (sRGB.HSV[0,.7,.8]) `intersection` cube(tau*3), 25 schwartzize(.1) (cube 20), 26] 27