#version 3.8; global_settings {assumed_gamma 1.0} background {rgb (y+z)/2} light_source {<0, 0, -50> rgb 1} light_source {<0, 10, -10> rgb 1} //sky_sphere {pigment {rgb 1}} #declare E = 0.00001; camera { location <0, 0, -6> right x*image_width/image_height up y look_at <0, 0, 0> rotate x*15 } #declare DocVase = array { <0.000, 0.000> <0.118, 0.000> <0.620, 0.540> <0.210, 0.827> <0.194, 0.962> <0.286, 1.000> <0.468, 1.033> } #declare EqualZero = array { <0.000, 0.000> <0.100, 0.000> <0.620, 0.540> <0.210, 0.827> <0.1, 0.9> <0.3, 1.00> <0.0, 2.0> } #declare LastCP = array { <0.000, 0.000> <0.118, 0.000> <0.620, 0.540> <0.210, 0.827> <0.194, 0.962> <0.286, 1.000> <0.468, 0> } #declare FirstLastSwitched = array { <0.468, 1.033> <0.000, 0.000> <0.118, 0.000> <0.620, 0.540> <0.210, 0.827> <0.194, 0.962> <0.286, 1.000> <0.000, 0.000> } #declare MiddleSwitched = array { <0.000, 2.000> <0.100, 0.000> <0.210, 0.827> <0.620, 0.540> <0.1, 0.9> <0.3, 1.00> <0.0, 0.0> } #macro Hex (Color) #local LT = 0.1; // Line Thickness tiling 2 color_map { [0.00 rgb Color] [1-LT rgb Color] [1-LT rgb 0] [1.00 rgb 0] } // end color_map rotate -x*90 #end // Make a solid of revolution using the inbuilt source algorithm #macro SOR (Array, Open) sor { #local N = dimension_size (Array, 1)-1; N+1 #for (PP, 0, N) Array [PP] #end #if (Open) open #end sturm } #end #macro SOR_Open (Array) sor { #local N = dimension_size (Array, 1)-1; N+1 #for (PP, 0, N) Array [PP] #end open //sturm } #end #macro CenteredText (String) #local TO = text { ttf "arial.ttf", String, 0.02, 0.0} #local Min = min_extent (TO); #local Max = max_extent (TO); #local Half = -(Max.x-Min.x)/2; object {TO translate x*Half no_shadow rotate x*15} #end //SOR (MiddleSwitched) #declare Org = (x+x+y)/2; #declare Open = yes; #declare SOR1 = object {SOR (DocVase, Open) } #declare SOR2 = object {SOR (EqualZero, Open) } #declare SOR3 = object {SOR (LastCP, Open) } // this sucks that we have to use an untextured object as a cutter to be able to use cutaway_textures // one would reasonably expect that we should be able to use any object // if, as per wiki documentation, the cutaway_textures feature result is based on insidedness tests, then the texture of the cutter should be irrelevant object {CenteredText ("Various permutations of the rendering of sor {open}") pigment {rgb 0} scale 0.25 translate y*2 } union { object {SOR1 texture {uv_mapping pigment {Hex (y) scale 0.05}} interior_texture {uv_mapping pigment {Hex (x) scale 0.05}} } object {CenteredText ("sor {}") pigment {rgb 0} scale 0.25 translate -y*0.25} translate -x*3 } union { object {SOR2 texture {uv_mapping pigment {Hex (y) scale 0.05}} interior_texture {uv_mapping pigment {Hex (x) scale 0.05}} } object {CenteredText ("cp's ON axis") pigment {rgb 0} scale 0.25 translate -y*0.25} translate -x } union { difference {box {<-0.75, 0, 0>, <0.75, 1, 1> pigment {rgb Org}} object {SOR1 texture {uv_mapping pigment {Hex (y) scale 0.05}} interior_texture {uv_mapping pigment {Hex (x) scale 0.05}}} } object {CenteredText ("box{} - sor{}") pigment {rgb 0} scale 0.25 translate -y*0.25} translate x } union { difference {object {SOR1 texture {uv_mapping pigment {Hex (y) scale 0.05}} interior_texture {uv_mapping pigment {Hex (x) scale 0.05}}} box {<-0.75, -E, 0>, <0.75, 1+E, -1> pigment {rgb Org}} } object {CenteredText ("sor{} - box{}") pigment {rgb 0} scale 0.25 translate -y*0.25} translate x*3 } union { object {SOR3 texture {uv_mapping pigment {Hex (y) scale 0.04}} interior_texture {uv_mapping pigment {Hex (x) scale 0.05}} } // scale changed object {CenteredText ("top cp ") pigment {rgb 0} scale 0.25 translate -y*0.25} object {CenteredText ("doubles back") pigment {rgb 0} scale 0.25 translate -y*0.5} translate -x*3 translate -y*2 } union { object {SOR1 texture {uv_mapping pigment {Hex (y) scale 0.05}} interior_texture {uv_mapping pigment {Hex (x) scale 0.05}} clipped_by {box {<-0.75, 0, 0>, <0.75, 1, 1>}} } object {CenteredText ("sor {}") pigment {rgb 0} scale 0.25 translate -y*0.25} object {CenteredText ("clipped_by") pigment {rgb 0} scale 0.25 translate -y*0.5} translate -x translate -y*2 } union { difference {box {<-0.75, 0, 0>, <0.75, 1, 1> pigment {rgb Org}} object {SOR1} cutaway_textures } object {CenteredText ("box{} - sor{}") pigment {rgb 0} scale 0.25 translate -y*0.25} object {CenteredText ("cutaway_textures") pigment {rgb 0} scale 0.25 translate -y*0.5} translate x translate -y*2 } union { difference {object {SOR1 texture {uv_mapping pigment {Hex (y) scale 0.05}} interior_texture {uv_mapping pigment {Hex (x) scale 0.05}}} box {<-0.75, -E, 0>, <0.75, 1+E, -1> } cutaway_textures } object {CenteredText ("sor{} - box{}") pigment {rgb 0} scale 0.25 translate -y*0.25} object {CenteredText ("cutaway_textures") pigment {rgb 0} scale 0.25 translate -y*0.5} translate x*3 translate -y*2 } // we would reasonably expect the interior_texture to be displayed object {CenteredText ("Crossing axis or doubling back in y results in: \"Parse Error: Incorrect point in surface of revolution\"") pigment {rgb 0} scale 0.2 translate -y*3} //Difference //Intersection //cutaway_textures //clipped_by //the sor is acted upon by another object functioning as the "cutter" //the sor acts upon another object as the "cutter" //control points ON the axis of rotation. //control points crossing the axis // "Parse Error: Incorrect point in surface of revolution" //properly ordered control points //improperly ordered control points //first and last control points in all orientations