Advertisement
mate2code

Myers-Briggs tesseract

Mar 11th, 2019
2,714
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // https://commons.wikimedia.org/wiki/File:Myers-Briggs_tesseract.png
  2. // height/width=10/11, e.g. +H4000 +W4400
  3.  
  4. #version 3.6;
  5. global_settings { assumed_gamma 1.0 }
  6. #default{ finish{ ambient 0.1 diffuse 0.9 conserve_energy}}
  7.  
  8. #include "colors.inc"
  9.  
  10.  
  11. ////////////////////////////////////////////////////////////////////////
  12.  
  13. #declare Camera_Position = <4, 7, -30>;
  14. camera{
  15.     location Camera_Position
  16.     right    x*image_width/image_height
  17.     angle    12.5
  18.     look_at  <-.19, -.2, 0>
  19. }
  20.  
  21.  
  22. light_source{ <-400, 500, -300> color White*0.9 shadowless}
  23. light_source{ <400, 200, 100> color White*0.4 shadowless}
  24. light_source{ Camera_Position  color rgb<0.9,0.9,1>*0.2 shadowless}
  25. sky_sphere{ pigment{ White } }
  26.  
  27.  
  28. ////////////////////////////////////////////////////////////////////////
  29.  
  30. #declare RadEdge = .01;
  31. #declare RadVert = .05;
  32. #declare RadScale = .6;
  33.  
  34. #declare VertexRankParities = array[16]{ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }
  35.  
  36. #declare Scale = .47;
  37. #declare P = array[16]{
  38.     <-1,-1,-1>, <-1,1,-1>, <-1,-1,1>, <-1,1,1>, <1,-1,-1>, <1,1,-1>, <1,-1,1>, <1,1,1>,
  39.     <-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
  40. };
  41.  
  42. #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} };
  43.  
  44. #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} };
  45.  
  46. #declare Text = array[16]{ "ESFJ", "ESFP", "ENFJ", "ENFP","ESTJ", "ESTP", "ENTJ", "ENTP", "ISFJ", "ISFP", "INFJ", "INFP","ISTJ", "ISTP", "INTJ", "INTP" };
  47.  
  48. ////////////////////////////////////////////////////////////////////////
  49.  
  50. union{
  51.  
  52.     // VERTICES
  53.     union{
  54.         #for( Index, 0, 15 )
  55.             #if(Index<8)   #local R = RadVert;   #else   #local R = RadVert*RadScale;   #end
  56.             sphere{
  57.                 P[Index], R
  58.                 #if(VertexRankParities[Index])
  59.                     pigment{color rgb<1,0.8,0.65>*.2}
  60.                 #else
  61.                     pigment{color rgb<1,0.8,0.65>*.5}
  62.                 #end
  63.             }
  64.         #end
  65.     }
  66.  
  67.     // EDGES
  68.     union{
  69.         #for( Index, 0, 31 )
  70.             #local EdgeArray = Edges[Index];
  71.             #local A = EdgeArray[0];
  72.             #local B = EdgeArray[1];
  73.             #if(A<8)   #local RadA = RadEdge;   #else   #local RadA = RadEdge*RadScale;   #end
  74.             #if(B<8)   #local RadB = RadEdge;   #else   #local RadB = RadEdge*RadScale;   #end
  75.             cone{ P[A], RadA, P[B], RadB }
  76.         #end
  77.         pigment{color rgb .5}
  78.     }
  79.  
  80.     // FACES
  81.     union{
  82.         #for( Index, 0, 23 )
  83.             #local FaceArray = Faces[Index];
  84.             polygon{ 5, P[FaceArray[0]], P[FaceArray[1]], P[FaceArray[3]], P[FaceArray[2]], P[FaceArray[0]] }
  85.         #end
  86.         pigment{color rgbt<0, 0, 1, .8>}
  87.     }
  88.  
  89.     // VERTEX LABELS
  90.     #for( Index, 0, 15 )
  91.         text { ttf "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf",  Text[Index],  .03,  0
  92.  
  93.             #if(Index<8)   scale .1   #else   scale .075   #end    // labels for the inner cube are smaller
  94.  
  95.             translate P[Index]   // move label from center to vertex
  96.  
  97.             #if(Index<8)  // OUTSIDE
  98.  
  99.                 #if(mod(div(Index,4),2))  // RIGHT
  100.                     translate .2*x
  101.                 #else                     // LEFT
  102.                     translate -.2*x
  103.                 #end
  104.  
  105.                 #if(mod(Index, 2))  // TOP
  106.                     translate .065*y
  107.                 #else               // BOTTOM
  108.                     translate -.065*y
  109.                 #end
  110.  
  111.                 translate <-.12, -.035, 0>
  112.  
  113.             #else         // INSIDE
  114.  
  115.                 #if(mod(div(Index,4),2))  // RIGHT
  116.                     translate -.135*x
  117.                 #else                     // LEFT
  118.                     translate .135*x
  119.                 #end
  120.  
  121.                 #if(mod(Index, 2))  // TOP
  122.                     translate -.06*y
  123.                 #else               // BOTTOM
  124.                     translate .06*y
  125.                 #end
  126.  
  127.                 translate <-.072, -.029, 0>
  128.  
  129.             #end
  130.  
  131.         }
  132.     #end
  133.  
  134.     scale 2.25
  135.  
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement