// Sphere of Torii - The math doesn't work :( // Peter Houston #version 3.1; #include "colors.inc" global_settings { assumed_gamma 1.0 } // ---------------------------------------- camera { location <0.0, .5, -3.5> direction 1.5*z right 4/3*x look_at <0.0, 0.0, 0.0> } sky_sphere { pigment { gradient y color_map { [0.0 color blue 0.6] [1.0 color rgb 1] } } } light_source { 0*x // light's position (translated below) color red 1.0 green 1.0 blue 1.0 // light's color translate <-30, 30, -30> } // ---------------------------------------- plane { y, -1 pigment {color rgb <0.7,0.5,0.3>}} #macro Rotate_Torus ( X , Y , Z ) // Calculate angle of rotation on the Y Axis #declare LengthP=sqrt((Z*Z)+(X*X)); #declare YTan=tan(Z/X); #declare YRotAngle=atan2(YTan,1); // Calculate angle of Rotation on the Z Azis #declare ZTan=tan(LengthP/(1-Y)); #declare ZRotAngle=atan2(ZTan,1); torus {0.15, 0.015 translate <0,1,0> rotate y*-YTan//YRotAngle rotate z*-ZTan//ZRotAngle pigment {Red} } // Marker for reference these should end up in the centre of the torii sphere {,.05 pigment {Yellow}} #end #declare Torus_Ball_Eighth = union { // joints Rotate_Torus ( 0.0000000000, 1.0000000000, 0.0000000000 ) Rotate_Torus ( 0.0000000000, 0.9807852804, 0.1950903220 ) Rotate_Torus ( 0.1950903220, 0.9807852804, 0.0000000000 ) Rotate_Torus ( 0.0000000000, 0.9238795325, 0.3826834324 ) Rotate_Torus ( 0.1987568534, 0.9596829823, 0.1987568534 ) Rotate_Torus ( 0.3826834324, 0.9238795325, 0.0000000000 ) Rotate_Torus ( 0.0000000000, 0.8314696123, 0.5555702330 ) Rotate_Torus ( 0.2088465989, 0.8903200345, 0.4046150446 ) Rotate_Torus ( 0.0000000000, 0.7071067812, 0.7071067812 ) Rotate_Torus ( 0.2113248654, 0.7886751346, 0.5773502692 ) Rotate_Torus ( 0.4082482905, 0.8164965809, 0.4082482905 ) Rotate_Torus ( 0.4046150446, 0.8903200345, 0.2088465989 ) Rotate_Torus ( 0.5555702330, 0.8314696123, 0.0000000000 ) Rotate_Torus ( 0.5773502692, 0.7886751346, 0.2113248654 ) Rotate_Torus ( 0.7071067812, 0.7071067812, 0.0000000000 ) Rotate_Torus ( 0.0000000000, 0.5555702330, 0.8314696123 ) Rotate_Torus ( 0.2113248654, 0.5773502692, 0.7886751346 ) Rotate_Torus ( 0.0000000000, 0.3826834324, 0.9238795325 ) Rotate_Torus ( 0.2088465989, 0.4046150446, 0.8903200345 ) Rotate_Torus ( 0.4082482905, 0.4082482905, 0.8164965809 ) Rotate_Torus ( 0.0000000000, 0.1950903220, 0.9807852804 ) Rotate_Torus ( 0.1987568534, 0.1987568534, 0.9596829823 ) Rotate_Torus ( 0.0000000000, 0.0000000000, 1.0000000000 ) Rotate_Torus ( 0.1950903220, 0.0000000000, 0.9807852804 ) Rotate_Torus ( 0.3826834324, 0.0000000000, 0.9238795325 ) Rotate_Torus ( 0.4046150446, 0.2088465989, 0.8903200345 ) Rotate_Torus ( 0.5773502692, 0.2113248654, 0.7886751346 ) Rotate_Torus ( 0.5555702330, 0.0000000000, 0.8314696123 ) Rotate_Torus ( 0.7071067812, 0.0000000000, 0.7071067812 ) Rotate_Torus ( 0.7886751346, 0.5773502692, 0.2113248654 ) Rotate_Torus ( 0.8314696123, 0.5555702330, 0.0000000000 ) Rotate_Torus ( 0.8164965809, 0.4082482905, 0.4082482905 ) Rotate_Torus ( 0.8903200345, 0.4046150446, 0.2088465989 ) Rotate_Torus ( 0.9238795325, 0.3826834324, 0.0000000000 ) Rotate_Torus ( 0.7886751346, 0.2113248654, 0.5773502692 ) Rotate_Torus ( 0.8903200345, 0.2088465989, 0.4046150446 ) Rotate_Torus ( 0.8314696123, 0.0000000000, 0.5555702330 ) Rotate_Torus ( 0.9238795325, 0.0000000000, 0.3826834324 ) Rotate_Torus ( 0.9596829823, 0.1987568534, 0.1987568534 ) Rotate_Torus ( 0.9807852804, 0.1950903220, 0.0000000000 ) Rotate_Torus ( 0.9807852804, 0.0000000000, 0.1950903220 ) Rotate_Torus ( 1.0000000000, 0.0000000000, 0.0000000000 ) Rotate_Torus ( 0.6396021491, 0.4264014327, 0.6396021491 ) Rotate_Torus ( 0.6396021491, 0.6396021491, 0.4264014327 ) Rotate_Torus ( 0.4264014327, 0.6396021491, 0.6396021491 ) } #declare Torus_Ball_Hemisphere = union { object { Torus_Ball_Eighth } object { Torus_Ball_Eighth rotate <0, 90, 0> } object { Torus_Ball_Eighth rotate <0, 180, 0> } object { Torus_Ball_Eighth rotate <0, 270, 0> } } #declare Torus_Ball = union { object { Torus_Ball_Hemisphere } object { Torus_Ball_Hemisphere rotate <180, 0, 0> } } //object {Torus_Ball_Eighth} object {Torus_Ball}