// circle inversion transform using v3.5 features // by Peter C. Capasso // btw, some background information can be found at: // http://mathworld.wolfram.com/topics/InversiveGeometry.html // specifically: // http://mathworld.wolfram.com/InversePoints.html #version 3.5; global_settings { noise_generator 1 assumed_gamma 2.2 // set to same as display_gamma } camera { orthographic location 0 direction <0, 0, 1> right <2 * (image_width / image_height), 0, 0> up <0, 2, 0> translate <0, 0, -10> } #macro lazy_map(lm_filename) #local lz_sl = strlen(lm_filename); #local lz_ext = strlwr(substr(lm_filename, lz_sl - 2, 3)) // get file type #if (strcmp(lz_ext, "tga") = 0) tga lm_filename #else #if (strcmp(lz_ext, "png") = 0) png lm_filename #else #if (strcmp(lz_ext, "gif") = 0) gif lm_filename #else #if (strcmp(lz_ext, "iff") = 0) iff lm_filename #else #if (strcmp(lz_ext, "jpg") = 0) jpeg lm_filename #else #if (strcmp(lz_ext, ".jp") = 0) jpeg lm_filename #else #if (strcmp(lz_ext, "jp") = 0) jpeg lm_filename #else sys lm_filename #end #end #end #end #end #end #end #end #macro c_invert(pig_in) #local f1 = function { pigment { pig_in } }; #local f2R = function { f1( 1 / max(0.0001, sqrt((x*x)+(y*y)))*cos(atan2(x,y)), 1 / max(0.0001, sqrt((x*x)+(y*y)))*sin(atan2(x,y)), z ).red }; #local f2G = function { f1( 1 / max(0.0001, sqrt((x*x)+(y*y)))*cos(atan2(x,y)), 1 / max(0.0001, sqrt((x*x)+(y*y)))*sin(atan2(x,y)), z ).green }; #local f2B = function { f1( 1 / max(0.0001, sqrt((x*x)+(y*y)))*cos(atan2(x,y)), 1 / max(0.0001, sqrt((x*x)+(y*y)))*sin(atan2(x,y)), z ).blue }; #local f3 = pigment { average pigment_map { [ 1 function { f2R(x,y,z) } color_map { [ 0.0 color rgb 0 ] [ 1.0 color rgb <3, 0, 0> ] } ] [ 1 function { f2G(x,y,z) } color_map { [ 0.0 color rgb 0 ] [ 1.0 color rgb <0, 3, 0> ] } ] [ 1 function { f2B(x,y,z) } color_map { [ 0.0 color rgb 0 ] [ 1.0 color rgb <0, 0, 3> ] } ] } } f3 #end plane { <0, 0, -1>, 0 pigment { c_invert( pigment { // your pigment here (instead of the checker) checker color rgb 0, color rgb 1 scale 0.4 } ) scale 0.8 } finish { ambient 1 diffuse 0 } } /* actual end of this file */