#include "colors.inc"

#declare r5 = 0.5 / sin (radians(36));
#declare rho5 = 0.5 * tan (radians(54));
#declare rho6 = 0.5 * tan (radians(60));
#declare v1 = 90 - degrees(asin(rho5/rho6));
#debug concat("v1 = ", str(v1, 0, 5), "\n")
#declare a = rho6 * cos(radians(v1)) + r5;
#declare b = 1;
#declare c = sqrt(a*a + b*b);
#declare d = rho6 * sin(radians(v1));
#declare v2 = 2 * degrees (asin(d/(c-r5)));
#debug concat("v2 = ", str(v2, 0, 5), "\n")
#declare e = sin(radians(72));
#debug concat("e = ", str(e, 0, 5), "\n")
#declare f = e * sin(radians(v1));
#debug concat("f = ", str(f, 0, 5), "\n")
#declare v3 = degrees (asin(f/rho6)) + v1;
#debug concat("v3 = ", str(v3, 0, 5), "\n")


#declare buckyball =
    intersection {
	plane {
	    <0, 1, 0> 1 
	    pigment { color rgbf <1, 0, 0, 0.5> }
	}
	#declare i = 0; 
	#while (i < 360) 
	    plane {
		<0, 1, 0> 1 
		pigment { color rgbf <1, 1, 0, 0.5> }
		rotate <0, 0, v1>
		rotate <0, i, 0>
	    }
	    #declare i = i + 72;
	#end

	#declare i = 36; 
	#while (i < 360) 
	    plane {
		<0, 1, 0> 1 
		pigment { color rgbf <0, 1, 0, 0.5> }
		rotate <0, 0, v2>
		rotate <0, i, 0>
	    }
	    #declare i = i + 72;
	#end

	#declare i = 0; 
	#while (i < 360) 
	    plane {
		<0, 1, 0> 1 
		pigment { color rgbf <0, 1, 1, 0.5> }
		rotate <0, 0, v3>
		rotate <0, i, 0>
	    }
	    #declare i = i + 72;
	#end

	#declare i = 36; 
	#while (i < 360) 
	    plane {
		<0, 1, 0> 1 
		pigment { color rgbf <0, 0, 1, 0.5> }
		rotate <0, 0, 180 - v3>
		rotate <0, i, 0>
	    }
	    #declare i = i + 72;
	#end

	#declare i = 0; 
	#while (i < 360) 
	    plane {
		<0, 1, 0> 1 
		pigment { color rgbf <1, 0, 1, 0.5> }
		rotate <0, 0, 180-v2>
		rotate <0, i, 0>
	    }
	    #declare i = i + 72;
	#end

	#declare i = 36; 
	#while (i < 360) 
	    plane {
		<0, 1, 0> 1 
		pigment { color rgbf <1, 0, 0, 0.5> }
		rotate <0, 0, 180-v1>
		rotate <0, i, 0>
	    }
	    #declare i = i + 72;
	#end

	plane {
	    <0, 1, 0> 1 
	    pigment { color rgbf <1, 1, 0, 0.5> }
	    rotate <0, 0, 180>
	}
    }



