// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10 /* "PrettyBall_1" for MathMod by Abderrahman Taha 2020-08-03 Rewritten for POV-Ray by kurz le pirate 2024-12-25, lb v3 Simplified, optimized and reformatted by Tor Olav Kristensen 2024-12-28 */ // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10 #version 3.7; #include "colors.inc" #include "functions.inc" global_settings { assumed_gamma 1.8 max_trace_level 5 } default { finish { ambient 0.00 emission 0.40 diffuse 0.60 specular 1.0 roughness 0.0005 metallic 1.0 // brilliance 2 } } // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10 #declare L = 23/2; #declare H = 1e-4; #declare H2 = 2*H; #declare Th2 = -8/10; #declare Th1 = +5/10; #declare N = 2; #declare GyroidFn = function { cos(x)*sin(y) + cos(y)*sin(z) + cos(z)*sin(x) }; #declare DerFnX = function { (GyroidFn(x + H, y, z) - GyroidFn(x - H, y, z))/H2 }; #declare DerFnY = function { (GyroidFn(x, y + H, z) - GyroidFn(x, y - H, z))/H2 }; #declare DerFnZ = function { (GyroidFn(x, y, z + H) - GyroidFn(x, y, z - H))/H2 }; #declare Fn = function(x, y, z, dx, dy, dz, s) { GyroidFn( x + dx*s, y + dy*s, z + dz*s ) } ; #declare ConditionFn = function { - pow(L - 1/10, N) + pow(x, N) + pow(y, N) + pow(z, N) } ; #declare GyroidLatticeFn1 = function(x, y, z, dx, dy, dz, c) { select( c, Fn(x, y, z, dx, dy, dz, +Th2/f_r(dx, dy, dz)), 1 ) - exp(c/5) } ; #declare GyroidLatticeFn2 = function(x, y, z, dx, dy, dz, c) { select( c, Fn(x, y, z, dx, dy, dz, -Th2/f_r(dx, dy, dz)), 1 ) + exp(c/5) } ; #declare GyroidLatticeFn3 = function(x, y, z, dx, dy, dz, c) { select( c, Fn(x, y, z, dx, dy, dz, +Th1/f_r(dx, dy, dz)) * // Thick Fn(x, y, z, dx, dy, dz, -Th1/f_r(dx, dy, dz)), 1 ) + exp(c/5) } ; isosurface { function { GyroidLatticeFn1( x, y, z, DerFnX(x, y, z), DerFnY(x, y, z), DerFnZ(x, y, z), ConditionFn(x, y, z) ) } max_gradient 3424 contained_by { sphere { <0, 0, 0>, L } } open pigment { color rgb <0.285437, 0.207759, 0.106593> } } isosurface { function { GyroidLatticeFn2( x, y, z, DerFnX(x, y, z), DerFnY(x, y, z), DerFnZ(x, y, z), ConditionFn(x, y, z) ) } max_gradient 4512 contained_by { sphere { <0, 0, 0>, L } } open pigment { color rgb <0.283700, 0.273100, 0.229000> } } isosurface { function { GyroidLatticeFn3( x, y, z, DerFnX(x, y, z), DerFnY(x, y, z), DerFnZ(x, y, z), ConditionFn(x, y, z) ) } max_gradient 162 contained_by { sphere { <0, 0, 0>, L } } open pigment { color rgb <0.908712, 0.782364, 0.605954> } } // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10 #declare AR = image_width/image_height; camera { location <40, 17, 30> right AR*x look_at <0, 0, 0> angle 40 } light_source { <75, 50, 43> color White } sky_sphere { pigment { function { abs(y) } color_map { [ 0.0 color 0.50*SlateBlue ] [ 1.0 color 1.25*White ] } } } // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10