// The purpose of this scene is to demonstrate the geometry involved // in using a torus to proved a shoulder curve to a cylinder or cone // // the tangent poing of the torus and the wall is calculated and the // wall is truncated at that point. // The objects are 'sliced' with colored planes to show the geometry #include "colors.inc" camera { orthographic location <-4.5, .20, -10> look_at <-4.5, .20, 0.0> angle 10 } light_source { 0*x // light's position (translated below) color rgb <1,1,1> * 1.5 // light's color translate <-20, 40, -20> } light_source { 0*x // light's position (translated below) color rgb <1,1,1> * 8 // light's color translate <0, 0, -20> } background {color White} #macro MakeIt (H, // Cone Height BR, // Cone Base Radius TR, // Cone Top Radius mr, // Shoulder Radius (torus minor radius) T, // Thickness X) // if non-zero, Slice image in half #local AngA = atan((BR-TR)/H); #local a = sin(AngA) * mr; #local b = cos(AngA) * mr; #local Voff = mr + a; #local Hoff = tan(AngA) * Voff; #local MR = BR - (Hoff + b); //torus major radius //#Scale = (BR-T)/BR; #if (mr <= 0) #local mr = .00001; #end #if (TR <= 0) #local TR = .00001; #end difference { difference { cone {<0,Voff,0>BR-Hoff <0,H,0>TR pigment {color White}} cone {<0,Voff,0> BR-Hoff-T <0,H+T,0>TR-T pigment {color Green}} } #if (X > 0) plane {z,.002 pigment {color Gray15}} #end } difference { torus {BR-Hoff-b,mr pigment {color Yellow}} #if (X > 0) plane {z,0 pigment {color <0,1,1>}} #end translate <0,mr,0> } #end MakeIt (5, // Cone Height 5, // Cone Base Radius 0, // Cone Top Radius .2, // Shoulder Radius (torus minor radius) .05, // Wall Thickness 1) // Slice (if non-zero, Slice image in half)