Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://commons.wikimedia.org/wiki/File:Tesseract_Schlegel_numbered.png
- // height/width=20/19, e.g. +H4000 +W3800
- #version 3.6;
- global_settings { assumed_gamma 1.0 }
- #default{ finish{ ambient 0.1 diffuse 0.9 conserve_energy}}
- #include "colors.inc"
- ////////////////////////////////////////////////////////////////////////
- #declare Camera_Position = <4, 7, -30>;
- camera{
- location Camera_Position
- right x*image_width/image_height
- angle 11
- look_at <-.15, -.2, 0>
- }
- light_source{ <-400, 500, -300> color White*0.9 shadowless}
- light_source{ <400, 200, 100> color White*0.4 shadowless}
- light_source{ Camera_Position color rgb<0.9,0.9,1>*0.2 shadowless}
- sky_sphere{ pigment{ White } }
- ////////////////////////////////////////////////////////////////////////
- #declare RadEdge = .01;
- #declare RadVert = .05;
- #declare RadScale = .6;
- #declare VertexRankParities = array[16]{ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }
- #declare Scale = .47;
- #declare P = array[16]{
- <-1,-1,-1>, <-1,1,-1>, <-1,-1,1>, <-1,1,1>, <1,-1,-1>, <1,1,-1>, <1,-1,1>, <1,1,1>,
- <-1,-1,-1>*Scale, <-1,1,-1>*Scale, <-1,-1,1>*Scale, <-1,1,1>*Scale, <1,-1,-1>*Scale, <1,1,-1>*Scale, <1,-1,1>*Scale, <1,1,1>*Scale
- };
- #declare Edges = array[32]{ array[2]{0, 1}, array[2]{0, 2}, array[2]{1, 3}, array[2]{2, 3}, array[2]{0, 4}, array[2]{1, 5}, array[2]{4, 5}, array[2]{2, 6}, array[2]{4, 6}, array[2]{3, 7}, array[2]{5, 7}, array[2]{6, 7}, array[2]{0, 8}, array[2]{1, 9}, array[2]{8, 9}, array[2]{2, 10}, array[2]{8, 10}, array[2]{3, 11}, array[2]{9, 11}, array[2]{10, 11}, array[2]{4, 12}, array[2]{8, 12}, array[2]{5, 13}, array[2]{9, 13}, array[2]{12, 13}, array[2]{6, 14}, array[2]{10, 14}, array[2]{12, 14}, array[2]{7, 15}, array[2]{11, 15}, array[2]{13, 15}, array[2]{14, 15} };
- #declare Faces = array[24]{ array[4]{0, 1, 2, 3}, array[4]{0, 1, 4, 5}, array[4]{0, 2, 4, 6}, array[4]{1, 3, 5, 7}, array[4]{2, 3, 6, 7}, array[4]{4, 5, 6, 7}, array[4]{0, 1, 8, 9}, array[4]{0, 2, 8, 10}, array[4]{1, 3, 9, 11}, array[4]{2, 3, 10, 11}, array[4]{8, 9, 10, 11}, array[4]{0, 4, 8, 12}, array[4]{1, 5, 9, 13}, array[4]{4, 5, 12, 13}, array[4]{8, 9, 12, 13}, array[4]{2, 6, 10, 14}, array[4]{4, 6, 12, 14}, array[4]{8, 10, 12, 14}, array[4]{3, 7, 11, 15}, array[4]{5, 7, 13, 15}, array[4]{9, 11, 13, 15}, array[4]{6, 7, 14, 15}, array[4]{10, 11, 14, 15}, array[4]{12, 13, 14, 15} };
- ////////////////////////////////////////////////////////////////////////
- union{
- // VERTICES
- union{
- #for( Index, 0, 15 )
- #if(Index<8) #local R = RadVert; #else #local R = RadVert*RadScale; #end
- sphere{
- P[Index], R
- #if(VertexRankParities[Index])
- pigment{color rgb<1,0.8,0.65>*.2}
- #else
- pigment{color rgb<1,0.8,0.65>*.5}
- #end
- }
- #end
- }
- // EDGES
- union{
- #for( Index, 0, 31 )
- #local EdgeArray = Edges[Index];
- #local A = EdgeArray[0];
- #local B = EdgeArray[1];
- #if(A<8) #local RadA = RadEdge; #else #local RadA = RadEdge*RadScale; #end
- #if(B<8) #local RadB = RadEdge; #else #local RadB = RadEdge*RadScale; #end
- cone{ P[A], RadA, P[B], RadB }
- #end
- pigment{color rgb .5}
- }
- // FACES
- union{
- #for( Index, 0, 23 )
- #local FaceArray = Faces[Index];
- polygon{ 5, P[FaceArray[0]], P[FaceArray[1]], P[FaceArray[3]], P[FaceArray[2]], P[FaceArray[0]] }
- #end
- pigment{color rgbt<0, 0, 1, .8>}
- }
- // VERTEX LABELS
- #for( Index, 0, 15 )
- text { ttf "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf", str(Index,2,0), .03, 0
- #if(Index<8) scale .11 #else scale .085 #end // labels for the inner cube are smaller
- translate P[Index] // move label from center to vertex
- #if(Index<8) // OUTSIDE
- #if(mod(div(Index,4),2)) // RIGHT
- translate .1*x
- #else // LEFT
- translate -.1*x
- #end
- #if(mod(Index, 2)) // TOP
- translate .068*y
- #else // BOTTOM
- translate -.068*y
- #end
- translate <-.063, -.035, 0>
- #else // INSIDE
- #if(mod(div(Index,4),2)) // RIGHT
- translate -.08*x
- #else // LEFT
- translate .08*x
- #end
- #if(mod(Index, 2)) // TOP
- translate -.062*y
- #else // BOTTOM
- translate .062*y
- #end
- translate <-.05, -.032, 0>
- #end
- }
- #end
- scale 2.25
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement