camera { orthographic right x * 5.6 / 2 up y * 5.6 location <1, 0, -3> look_at <1, -2.8, 0> } light_source { <0, 100, 0> rgb 1 } background { rgb z } union { isosurface { function { y - cos(2 * x - 1) + 0.01 } open max_gradient 5 contained_by { box { 0 1 } } pigment { color rgb 1 } } text { ttf "timrom" "Isosurface" 0.1 0 pigment { color rgb 0 } scale 0.25 translate <1.1, 1, 0>} translate <0, -1.1, 0> no_shadow } union { height_field { function 10, 10 { cos(2 * x - 1) } pigment { color rgb 1 } } text { ttf "timrom" "Heightfield" 0.1 0 pigment { color rgb 0 } scale 0.25 translate <1.1, 1, 0>} translate < 0, -2.2, 0> no_shadow } union { height_field { function 10, 10 { cos(2 * x - 1) } smooth pigment { color rgb 1 } } text { ttf "timrom" "Smooth HF" 0.1 0 pigment { color rgb 0 } scale 0.25 translate <1.1, 1, 0>} translate < 0, -3.3, 0> no_shadow } union { mesh2 { vertex_vectors { 9 * 9 #local YC = 0; #while (YC <= 8) #local XC = 0; #while (XC <= 8) #local X = XC / 8; #local Y = YC / 8; #local XC = XC + 1; #end #local YC = YC + 1; #end } face_indices { 8 * 8 * 2 #local YC = 0; #while (YC < 8) #local XC = 0; #while (XC < 8) <(YC + 1) * 9 + XC + 1, (YC + 1) * 9 + XC, YC * 9 + XC + 1> #local XC = XC + 1; #end #local YC = YC + 1; #end } pigment { color rgb 1 } } text { ttf "timrom" "Mesh" 0.1 0 pigment { color rgb 0 } scale 0.25 translate <1.1, 1, 0>} translate < 0, -4.4, 0> no_shadow } union { mesh2 { vertex_vectors { 9 * 9 #local YC = 0; #while (YC <= 8) #local XC = 0; #while (XC <= 8) #local X = XC / 8; #local Y = YC / 8; #local XC = XC + 1; #end #local YC = YC + 1; #end } normal_vectors { 9 * 9 #local YC = 0; #while (YC <= 8) #local XC = 0; #while (XC <= 8) #local X = XC / 8; #local Y = YC / 8; vcross( // Thanks to Warp for math and Trevor Quayle for explanation <1, -2 * sin(2 * X - 1), 0>, // for "1" in x go "gradient" up <0, 0, 1>) // for "1" in z go "gradient" up #local XC = XC + 1; #end #local YC = YC + 1; #end } face_indices { 8 * 8 * 2 #local YC = 0; #while (YC < 8) #local XC = 0; #while (XC < 8) <(YC + 1) * 9 + XC + 1, (YC + 1) * 9 + XC, YC * 9 + XC + 1> #local XC = XC + 1; #end #local YC = YC + 1; #end } normal_indices { 8 * 8 * 2 #local YC = 0; #while (YC < 8) #local XC = 0; #while (XC < 8) <(YC + 1) * 9 + XC + 1, (YC + 1) * 9 + XC, YC * 9 + XC + 1> #local XC = XC + 1; #end #local YC = YC + 1; #end } pigment { color rgb 1 } } text { ttf "timrom" "Smo. Mesh" 0.1 0 pigment { color rgb 0 } scale 0.25 translate <1.1, 1, 0>} translate < 0, -5.5, 0> no_shadow } union { mesh2 { vertex_vectors { 9 * 9 #local YC = 0; #while (YC <= 8) #local XC = 0; #while (XC <= 8) #local X = XC / 8; #local Y = YC / 8; #local XC = XC + 1; #end #local YC = YC + 1; #end } normal_vectors { 9 * 9 #local YC = 0; #while (YC <= 8) #local XC = 0; #while (XC <= 8) #local X = XC / 8; #local Y = YC / 8; #local Xnext = (XC + 1) / 8; #local Ynext = (YC + 1) / 8; #local Xprev = (XC - 1) / 8; #local Yprev = (YC - 1) / 8; #local N = <0, 0, 0>; #local P = ; #local P_0 = ; #local V_0 = P_0 - P; #local P_1 = ; #local V_1 = P_1 - P; #local P_2 = ; #local V_2 = P_2 - P; #local P_3 = ; #local V_3 = P_3 - P; #if (XC < 8 & YC < 8) #local N = N + vcross(V_0, V_1); #end #if (YC < 8 & XC > 0) #local N = N + vcross(V_1, V_2); #end #if (XC > 0 & YC > 0) #local N = N + vcross(V_2, V_3); #end #if (YC > 0 & XC < 8) #local N = N + vcross(V_3, V_0); #end N #local XC = XC + 1; #end #local YC = YC + 1; #end } face_indices { 8 * 8 * 2 #local YC = 0; #while (YC < 8) #local XC = 0; #while (XC < 8) <(YC + 1) * 9 + XC + 1, (YC + 1) * 9 + XC, YC * 9 + XC + 1> #local XC = XC + 1; #end #local YC = YC + 1; #end } normal_indices { 8 * 8 * 2 #local YC = 0; #while (YC < 8) #local XC = 0; #while (XC < 8) <(YC + 1) * 9 + XC + 1, (YC + 1) * 9 + XC, YC * 9 + XC + 1> #local XC = XC + 1; #end #local YC = YC + 1; #end } pigment { color rgb 1 } } text { ttf "timrom" "SM appr." 0.1 0 pigment { color rgb 0 } scale 0.25 translate <1.1, 1, 0>} translate < 0, -6.6, 0> no_shadow }