//EXAMPLE OF PROJECTION OF 16-CELL //EDGE FRAMEWORK //ADAPTED FROM KELCY MONDAY //Files with predefined colors and textures #include "colors.inc" #include "glass.inc" #include "golds.inc" #include "metals.inc" #include "stones.inc" #include "woods.inc" #include "textures.inc" //Place the camera camera { sky <0,0,1> //Don't change this direction <-1,0,0> //Don't change this right <-4/3,0,0> //Don't change this location <3,8,13> //Camera location look_at <0,0,0> //Where camera is pointing angle 25 //Angle of the view } //Ambient light to "brighten up" darker pictures global_settings { ambient_light White } global_settings { max_trace_level 10 } //Place a light light_source { <10,20,30> color White*2 } //Set a background color background { color White } //Specify the number of vertices #declare n=8; //List the vertices of the 16-cell #declare p = array[n][4] { {1,0,0,0}, //0 {0,1,0,0}, //1 {0,0,1,0}, //2 {0,0,0,1}, //3 {-1,0,0,0}, //4 {0,-1,0,0}, //5 {0,0,-1,0}, //6 {0,0,0,-1}, //7 }; //Create the array to collect the projected points #declare q = array[n]; //Specify the direction of projection #declare a=1; #declare b=1; #declare c=1; #declare d=1; //Specify the amount of translation away from the origin //Translating far away (large positive number) lessens perspective #declare pp=.4; //Perform perspective calculations #declare f=pp*(a*a+b*b+c*c+d*d); #declare i=0; #while(i; #declare i=i+1; #end #declare r=.03; //Edges of the projection union{ cylinder { q[0], q[1], r } cylinder { q[0], q[2], r } cylinder { q[0], q[3], r } cylinder { q[1], q[0], r } cylinder { q[1], q[2], r } cylinder { q[1], q[3], r } cylinder { q[2], q[0], r } cylinder { q[2], q[1], r } cylinder { q[2], q[3], r } cylinder { q[3], q[0], r } cylinder { q[3], q[1], r } cylinder { q[3], q[2], r } texture{Lightning2} } union{ cylinder { q[0], q[5], r } cylinder { q[0], q[6], r } cylinder { q[0], q[7], r } cylinder { q[1], q[4], r } cylinder { q[1], q[6], r } cylinder { q[2], q[4], r } cylinder { q[2], q[5], r } cylinder { q[2], q[7], r } cylinder { q[3], q[4], r } cylinder { q[3], q[5], r } cylinder { q[3], q[6], r } cylinder { q[4], q[1], r } cylinder { q[4], q[2], r } cylinder { q[4], q[3], r } cylinder { q[5], q[0], r } cylinder { q[5], q[2], r } cylinder { q[5], q[3], r } cylinder { q[6], q[0], r } cylinder { q[6], q[1], r } cylinder { q[6], q[3], r } cylinder { q[7], q[0], r } cylinder { q[7], q[1], r } cylinder { q[7], q[2], r } texture {Vicks_Bottle_Glass} } union{ cylinder { q[4], q[5], r } cylinder { q[4], q[6], r } cylinder { q[4], q[7], r } cylinder { q[5], q[4], r } cylinder { q[5], q[6], r } cylinder { q[5], q[7], r } cylinder { q[6], q[4], r } cylinder { q[6], q[5], r } cylinder { q[6], q[7], r } cylinder { q[7], q[4], r } cylinder { q[7], q[5], r } cylinder { q[7], q[6], r } texture {Rust} } #declare s=.06; //Vertices of the projection union{ sphere{q[0],s} sphere{q[1],s} sphere{q[2],s} sphere{q[3],s} sphere{q[4],s} sphere{q[5],s} sphere{q[6],s} sphere{q[7],s} texture {T_Gold_1A} }