mate2code

Cube subspaces (POV-Ray)

Sep 8th, 2019
736
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // https://commons.wikimedia.org/wiki/Category:Cube_subspaces_(black_in_gray)
  2.  
  3. #version 3.6;
  4. global_settings { assumed_gamma 1.0 }
  5. #default{ finish{ ambient 0.1 diffuse 0.9 conserve_energy}}
  6.  
  7. #include "colors.inc"
  8. #include "math.inc"
  9.  
  10.  
  11. ///////////////////////////// camera and light
  12.  
  13. #declare Camera_Position = <10, 15, -50>;
  14. camera{
  15.     location Camera_Position
  16.     right    x*image_width/image_height
  17.     angle    6.7
  18.     look_at  <-0.05, -0.10, -0.07>
  19. }
  20.  
  21. light_source{ <-400, 500, -300> color White*0.9 shadowless}
  22.  
  23. light_source{ Camera_Position  color rgb<0.9,0.9,1>*0.1 shadowless}
  24. sky_sphere{ pigment{ White } }
  25.  
  26.  
  27. ///////////////////////////// variables
  28.  
  29. #declare SkeletonColor = rgb<.8, .8, .8>;
  30.  
  31. #declare SubspaceColor = rgb<.05, .05, .05>;
  32. #declare SubspaceColorTransp = rgbt<.05, .05, .05, .1>;
  33.  
  34. #declare SkeletonRad = .03;
  35. #declare SubspaceRad = .09;
  36.  
  37. // cube coordinates
  38. #declare A = 2.25;
  39. #declare CC = array[8]{<-A,A,A>, <A,A,A>, <-A,-A,A>, <A,-A,A>, <-A,A,-A>, <A,A,-A>, <-A,-A,-A>, <A,-A,-A>}
  40.  
  41. #declare CubeEdgesAbstractCoordinates = array[12][2]{
  42.     {0,1}, {2,3}, {4,5}, {6,7}, {0,2}, {1,3}, {4,6}, {5,7}, {0,4}, {1,5}, {2,6}, {3,7}
  43. }
  44.  
  45.  
  46. ///////////////////////////// skeleton cube
  47.  
  48. #declare Skeleton = union{
  49.     #for(i, 0, 7)
  50.         sphere{CC[i], 2*SkeletonRad}
  51.     #end
  52.     #for(i, 0, 11)
  53.         cylinder{
  54.             CC[CubeEdgesAbstractCoordinates[i][0]],
  55.             CC[CubeEdgesAbstractCoordinates[i][1]],
  56.             SkeletonRad
  57.         }
  58.     #end
  59.     pigment{color SkeletonColor}
  60. }
  61.  
  62.  
  63. ///////////////////////////// subspaces
  64.  
  65. #declare Square = union{
  66.     union{
  67.         sphere{ <0,A,A>, 2*SubspaceRad }
  68.         sphere{ <0,-A,A>, 2*SubspaceRad }
  69.         sphere{ <0,-A,-A>, 2*SubspaceRad }
  70.         sphere{ <0,A,-A>, 2*SubspaceRad }
  71.         cylinder{ <0,A,A>, <0,-A,A>, SubspaceRad }
  72.         cylinder{ <0,-A,A>, <0,-A,-A>, SubspaceRad }
  73.         cylinder{ <0,-A,-A>, <0,A,-A>, SubspaceRad }
  74.         cylinder{ <0,A,-A>, <0,A,A>, SubspaceRad }
  75.         pigment{color SubspaceColor}
  76.     }
  77.     polygon{ 5, <0,A,A>, <0,-A,A>, <0,-A,-A>, <0,A,-A>, <0,A,A>
  78.         pigment{color SubspaceColorTransp}
  79.     }
  80. }
  81. #declare Rectangle = union{
  82.     union{
  83.         sphere{ CC[0], 2*SubspaceRad }
  84.         sphere{ CC[1], 2*SubspaceRad }
  85.         sphere{ CC[7], 2*SubspaceRad }
  86.         sphere{ CC[6], 2*SubspaceRad }
  87.         cylinder{ CC[0], CC[1], SubspaceRad }
  88.         cylinder{ CC[1], CC[7], SubspaceRad }
  89.         cylinder{ CC[7], CC[6], SubspaceRad }
  90.         cylinder{ CC[6], CC[0], SubspaceRad }
  91.         pigment{color SubspaceColor}
  92.     }
  93.     polygon{ 5, CC[0], CC[1], CC[7], CC[6], CC[0]
  94.         pigment{color SubspaceColorTransp}
  95.     }
  96. }
  97.  
  98. #declare Axis1 = union{
  99.     cylinder{ <0,0,-A>, <0,0,A>, SubspaceRad }
  100.     sphere{ <0,0,-A>, 2*SubspaceRad }
  101.     sphere{ <0,0,A>, 2*SubspaceRad }
  102.     pigment{color SubspaceColor}
  103. }
  104. #declare Axis2 = union{
  105.     cylinder{ <0,-A,-A>, <0,A,A>, SubspaceRad }
  106.     sphere{ <0,-A,-A>, 2*SubspaceRad }
  107.     sphere{ <0,A,A>, 2*SubspaceRad }
  108.     pigment{color SubspaceColor}
  109. }
  110. #declare Axis3 = union{
  111.     cylinder{ <-A,-A,-A>, <A,A,A>, SubspaceRad }
  112.     sphere{ <-A,-A,-A>, 2*SubspaceRad }
  113.     sphere{ <A,A,A>, 2*SubspaceRad }
  114.     pigment{color SubspaceColor}
  115. }
  116.  
  117. #declare Origin = sphere{ <0,0,0>, SubspaceRad*2
  118.     pigment{color SubspaceColor}
  119. }
  120.  
  121. ///////////////////////////// show
  122.  
  123. object{Skeleton}
  124. object{
  125.     Rectangle
  126.     rotate -90*y
  127.     // The rectangle with this rotation will create '2b (rectangle) 2'.
  128. }
RAW Paste Data