mate2code

Predicate logic; 3 variables; implications (POV-Ray)

Jan 19th, 2015
815
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // https://commons.wikimedia.org/wiki/File:Predicate_logic;_3_variables;_implications.png
  2.  
  3. #include "colors.inc"
  4.  
  5. light_source { <1500,2500,-2500> color White shadowless}
  6. light_source { <-8000,-8000,-8000> color Gray shadowless}
  7.  
  8. camera {
  9.     angle 23
  10.     location <1.65, 5.6 ,-12>
  11.     look_at  <2, 2, 2>
  12.     up    <0, 1, 0>
  13.     right   <1, 0, 0>
  14. }
  15.  
  16. ///////////////////////////////////////////////////////////////////////////////////////////////////////
  17. // define points
  18.  
  19. #declare e1_2_3 = <4,4,4>;
  20.  
  21. #declare a3e1_2 = <4,4,2>;
  22. #declare a2e1_3 = <4,2,4>;
  23. #declare a1e2_3 = <2,4,4>;
  24.  
  25. #declare e2a3e1 = <4,3,1>;
  26. #declare e1a3e2 = <3,4,1>;
  27. #declare e3a2e1 = <4,1,3>;
  28. #declare e1a2e3 = <3,1,4>;
  29. #declare e3a1e2 = <1,4,3>;
  30. #declare e2a1e3 = <1,3,4>;
  31.  
  32. #declare e1_2a3 = <3,3,0>;
  33. #declare e1_3a2 = <3,0,3>;
  34. #declare e2_3a1 = <0,3,3>;
  35.  
  36. #declare a2_3e1 = <4,1,1>;
  37. #declare a1_3e2 = <1,4,1>;
  38. #declare a1_2e3 = <1,1,4>;
  39.  
  40. #declare a2e1a3 = <3,1,0>;
  41. #declare a3e1a2 = <3,0,1>;
  42. #declare a1e2a3 = <1,3,0>;
  43. #declare a3e2a1 = <0,3,1>;
  44. #declare a1e3a2 = <1,0,3>;
  45. #declare a2e3a1 = <0,1,3>;
  46.  
  47. #declare e1a2_3 = <2,0,0>;
  48. #declare e2a1_3 = <0,2,0>;
  49. #declare e3a1_2 = <0,0,2>;
  50.  
  51. #declare a1_2_3 = <0,0,0>;
  52.  
  53. //////////////////////////
  54.  
  55. #declare a = 1;
  56. #declare b = 2;
  57. #declare c = 4-a;
  58. #declare d = 4-b;
  59.  
  60. #declare e12_3 = <3,3,4>;
  61. #declare a3e12 = <c,c,d>;
  62. #declare a12e3 = <2,2,4>;
  63. #declare e12a3 = <2,2,0>;
  64. #declare e3a12 = <a,a,b>;
  65. #declare a12_3 = <1,1,0>;
  66.  
  67. #declare e13_2 = <3,4,3>;
  68. #declare a2e13 = <c,d,c>;
  69. #declare a13e2 = <2,4,2>;
  70. #declare e13a2 = <2,0,2>;
  71. #declare e2a13 = <a,b,a>;
  72. #declare a13_2 = <1,0,1>;
  73.  
  74. #declare e1_23 = <4,3,3>;
  75. #declare a1e23 = <d,c,c>;
  76. #declare a23e1 = <4,2,2>;
  77. #declare e23a1 = <0,2,2>;
  78. #declare e1a23 = <b,a,a>;
  79. #declare a1_23 = <0,1,1>;
  80.  
  81. //////////////////////////
  82.  
  83. #declare e = 1.333;
  84. #declare f = 4-e;
  85.  
  86. #declare e123 = <f,f,f>;
  87. #declare a123 = <e,e,e>;
  88.  
  89. ///////////////////////////////////////////////////////////////////////////////////////////////////////
  90. // define vertex types
  91.  
  92. #macro V_brown( Point )
  93.     sphere{ Point, 0.1 pigment{color rgb<1,0.8,0.65>*0.05} }
  94. #end
  95. #macro V_yellow( Point )
  96.     sphere{ Point, 0.06 pigment{color Yellow*0.8} }
  97. #end
  98. #macro V_blue( Point )
  99.     sphere{ Point, 0.06 pigment{color rgb<0,0.1,1>} }
  100. #end
  101. #macro V_orange( Point )
  102.     sphere{ Point, 0.04 pigment{color rgb<1,0.1,0>} }
  103. #end
  104.  
  105. ///////////////////////////////////////////////////////////////////////////////////////////////////////
  106. // define edge types
  107. #macro E_brown1( P1, P2 )
  108.     cylinder{ P1, P2, 0.02  pigment{color rgb<1,0.8,0.65>*0.3 }}
  109. #end
  110. #macro E_brown2( P1, P2 )
  111.     cylinder{ P1, P2, 0.04  pigment{color rgb<1,0.8,0.65>*0.15 }}
  112. #end
  113. #macro E_yellow( P1, P2 )
  114.     cylinder{ P1, P2, 0.01  pigment{color Yellow*0.8}}
  115. #end
  116. #macro E_green1( P1, P2 )  // short, like cartesian axes
  117.     cylinder{ P1, P2, 0.01  pigment{color Green*0.3 }}
  118. #end
  119. #macro E_green2( P1, P2 )  // long, no intersections
  120.     cylinder{ P1, P2, 0.01  pigment{color rgb<0 ,0.7, 0.4>*0.7 }}
  121. #end
  122. #macro E_violet( P1, P2 )
  123.     cylinder{ P1, P2, 0.01  pigment{color rgb<0.3,0,1>*0.7 }}
  124. #end
  125. #macro E_gray( P1, P2 )
  126.     cylinder{ P1, P2, 0.01  pigment{color rgb<0.5,0.5,1>*0.4 }}
  127. #end
  128. #macro E_blue( P1, P2 )
  129.     cylinder{ P1, P2, 0.01  pigment{color rgb<0,0.1,1> }}
  130. #end
  131. #macro E_orange1( P1, P2 )  // short
  132.     cylinder{ P1, P2, 0.01*0.5  pigment{color rgb<1,0.1,0>*0.8}}
  133. #end
  134. #macro E_orange2( P1, P2 )  // long to yellow
  135.     cylinder{ P1, P2, 0.01*0.5  pigment{color rgb<1,0.2,0>*3}}
  136. #end
  137. #macro E_orange3( P1, P2 )  // long to blue
  138.     cylinder{ P1, P2, 0.01*0.5  pigment{color rgb<1,0.1,0.2>*2}}
  139. #end
  140. #macro E_orange4( P1, P2 )  // central
  141.     cylinder{ P1, P2, 0.01  pigment{color rgb<1,0.1,0> }}
  142. #end
  143.  
  144.  
  145. ///////////////////////////////////////////////////////////////////////////////////////////////////////
  146. // vertices
  147.  
  148. V_brown(e1_2_3)
  149. V_brown(a3e1_2) V_brown(a2e1_3) V_brown(a1e2_3)
  150. V_brown(e2a3e1) V_brown(e1a3e2) V_brown(e3a2e1) V_brown(e1a2e3) V_brown(e3a1e2) V_brown(e2a1e3)
  151. V_brown(e1_2a3) V_brown(e1_3a2) V_brown(e2_3a1)
  152. V_brown(a2_3e1) V_brown(a1_3e2) V_brown(a1_2e3)
  153. V_brown(a2e1a3) V_brown(a3e1a2) V_brown(a1e2a3) V_brown(a3e2a1) V_brown(a1e3a2) V_brown(a2e3a1)
  154. V_brown(e1a2_3) V_brown(e2a1_3) V_brown(e3a1_2)
  155. V_brown(a1_2_3)
  156.  
  157. V_yellow(e12_3) V_yellow(a12e3) V_yellow(e12a3) V_yellow(a12_3)
  158. V_yellow(e13_2) V_yellow(a13e2) V_yellow(e13a2) V_yellow(a13_2)
  159. V_yellow(e1_23) V_yellow(a23e1) V_yellow(e23a1) V_yellow(a1_23)
  160.  
  161. V_blue(a3e12) V_blue(e3a12) V_blue(a2e13) V_blue(e2a13) V_blue(a1e23) V_blue(e1a23)
  162.  
  163. V_orange(e123) V_orange(a123)
  164.  
  165. ///////////////////////////////////////////////////////////////////////////////////////////////////////
  166. // edges
  167.  
  168. E_brown1(a1_2_3, e1a2_3) E_brown1(a1_2_3, e2a1_3) E_brown1(a1_2_3, e3a1_2)
  169. E_brown2(e1a2_3, a2e1a3) E_brown2(e1a2_3, a3e1a2)   E_brown2(e2a1_3, a1e2a3) E_brown2(e2a1_3, a3e2a1)   E_brown2(e3a1_2, a1e3a2) E_brown2(e3a1_2, a2e3a1)
  170. E_brown2(a2e1a3, a2_3e1) E_brown2(a3e1a2, a2_3e1)   E_brown2(a1e2a3, a1_3e2) E_brown2(a3e2a1, a1_3e2)   E_brown2(a1e3a2, a1_2e3) E_brown2(a2e3a1, a1_2e3)
  171. E_brown1(a2e1a3, e1_2a3) E_brown1(a3e1a2, e1_3a2)   E_brown1(a1e2a3, e1_2a3) E_brown1(a3e2a1, e2_3a1)   E_brown1(a1e3a2, e1_3a2) E_brown1(a2e3a1, e2_3a1)
  172. E_brown2(e1_2a3, e2a3e1) E_brown2(e1_2a3, e1a3e2)   E_brown2(e1_3a2, e3a2e1) E_brown2(e1_3a2, e1a2e3)   E_brown2(e2_3a1, e3a1e2) E_brown2(e2_3a1, e2a1e3)
  173. E_brown1(a2_3e1, e2a3e1) E_brown1(a1_3e2, e1a3e2)   E_brown1(a2_3e1, e3a2e1) E_brown1(a1_2e3, e1a2e3)   E_brown1(a1_3e2, e3a1e2) E_brown1(a1_2e3, e2a1e3)
  174. E_brown2(e2a3e1, a3e1_2) E_brown2(e1a3e2, a3e1_2)   E_brown2(e3a2e1, a2e1_3) E_brown2(e1a2e3, a2e1_3)   E_brown2(e3a1e2, a1e2_3) E_brown2(e2a1e3, a1e2_3)
  175. E_brown1(a3e1_2, e1_2_3) E_brown1(a2e1_3, e1_2_3) E_brown1(a1e2_3, e1_2_3)
  176.  
  177. E_yellow(a1_2_3, a12_3)
  178. E_yellow(a12_3, e12a3)   E_yellow(a12_3, a2e1a3) E_yellow(a12_3, a1e2a3)   E_yellow(e1a2_3, e12a3) E_yellow(e2a1_3, e12a3)
  179. E_yellow(e12a3, e1_2a3)
  180.  
  181. E_yellow(a1_2_3, a13_2)
  182. E_yellow(a13_2, e13a2)   E_yellow(a13_2, a3e1a2) E_yellow(a13_2, a1e3a2)   E_yellow(e1a2_3, e13a2) E_yellow(e3a1_2, e13a2)
  183. E_yellow(e13a2, e1_3a2)
  184.  
  185. E_yellow(a1_2_3, a1_23)
  186. E_yellow(a1_23, e23a1)   E_yellow(a1_23, a3e2a1) E_yellow(a1_23, a2e3a1)   E_yellow(e2a1_3, e23a1) E_yellow(e3a1_2, e23a1)
  187. E_yellow(e23a1, e2_3a1)
  188.  
  189. E_yellow(e12_3, e1_2_3)
  190. E_yellow(a12e3, e12_3)   E_yellow(e2a1e3, e12_3) E_yellow(e1a2e3, e12_3)   E_yellow(a12e3, a1e2_3) E_yellow(a12e3, a2e1_3)
  191. E_yellow(a1_2e3, a12e3)
  192.  
  193. E_yellow(e13_2, e1_2_3)
  194. E_yellow(a13e2, e13_2)   E_yellow(e3a1e2, e13_2) E_yellow(e1a3e2, e13_2)   E_yellow(a13e2, a1e2_3) E_yellow(a13e2, a3e1_2)
  195. E_yellow(a1_3e2, a13e2)
  196.  
  197. E_yellow(e1_23, e1_2_3)
  198. E_yellow(a23e1, e1_23)   E_yellow(e3a2e1, e1_23) E_yellow(e2a3e1, e1_23)   E_yellow(a23e1, a2e1_3) E_yellow(a23e1, a3e1_2)
  199. E_yellow(a2_3e1, a23e1)
  200.  
  201. E_green1(a12_3, e3a12) E_green2(e12a3, a3e12)   E_green2(e3a12, a12e3) E_green1(a3e12, e12_3)
  202. E_green1(a13_2, e2a13) E_green2(e13a2, a2e13)   E_green2(e2a13, a13e2) E_green1(a2e13, e13_2)
  203. E_green1(a1_23, e1a23) E_green2(e23a1, a1e23)   E_green2(e1a23, a23e1) E_green1(a1e23, e1_23)
  204.  
  205. E_violet(e1a2_3, e1a23) E_violet(e2a1_3, e2a13) E_violet(e3a1_2, e3a12)
  206. E_violet(a1e23, a1e2_3) E_violet(a2e13, a2e1_3) E_violet(a3e12, a3e1_2)
  207.  
  208. E_gray(e3a12, e3a2e1) E_gray(e3a12, e3a1e2)   E_gray(e2a13, e2a1e3) E_gray(e2a13, e2a3e1)   E_gray(e1a23, e1a2e3) E_gray(e1a23, e1a3e2)
  209. E_gray(a3e1a2, a3e12) E_gray(a3e2a1, a3e12)   E_gray(a2e1a3, a2e13) E_gray(a2e3a1, a2e13)   E_gray(a1e2a3, a1e23) E_gray(a1e3a2, a1e23)
  210.  
  211. E_blue(e1a23, a2e13) E_blue(e1a23, a3e12)   E_blue(e2a13, a1e23) E_blue(e2a13, a3e12)   E_blue(e3a12, a1e23) E_blue(e3a12, a2e13)
  212.  
  213. E_orange1(a12_3, a123) E_orange1(e123, e12_3)
  214. E_orange1(a13_2, a123) E_orange1(e123, e13_2)
  215. E_orange1(a1_23, a123) E_orange1(e123, e1_23)
  216.  
  217. E_orange2(e12a3, e123) E_orange2(a123, a12e3)
  218. E_orange2(e13a2, e123) E_orange2(a123, a13e2)
  219. E_orange2(e23a1, e123) E_orange2(a123, a23e1)
  220.  
  221. E_orange3(e3a12, e123) E_orange3(a123, a3e12)
  222. E_orange3(e2a13, e123) E_orange3(a123, a2e13)
  223. E_orange3(e1a23, e123) E_orange3(a123, a1e23)
  224.  
  225. E_orange4(a123, e123)
RAW Paste Data