home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / graphics / ftpovst / libs / alphabet.inc next >
Text File  |  1993-02-24  |  15KB  |  627 lines

  1. // Persistence of Vision Raytracer
  2. //
  3. // alphabet.inc
  4. //
  5. // CSG Alphabet file.  Using several standard shapes and cut-outs, this file 
  6. // implements a 3 dimensional alphabet for use in POV traces.  These letters 
  7. // can be created, scaled, rotated, combined with other objects, subtracted 
  8. // from other objects, etc, to your heart's content.  As the "font" is 
  9. // relatively simple, it traces pretty fast, provided you bound the 
  10. // letters properly.
  11. //
  12. // Usage Notes:
  13. //
  14. // Due to some reason I can't remember anymore, the letters are created as
  15. // infinitely long objects along the Z axis. Each letter is 5 by 5 units 
  16. // in the x and y directions, with the bottom left corner of the 5 by 5 
  17. // square at the origin (0,0). 
  18. // 
  19. // Unfortunately, I haven't had the need or the time to create a lower 
  20. // case font to match, only upper case letters are supplied.
  21. //
  22. // For examples on how to use the font, see the examples in sample.inc
  23. //
  24. // Future (?) Improvements:
  25. //
  26. // It would probably make sense to truncate the things at z = 0 and z = 5, 
  27. // and rescale the result to make it 1 by 1.  If someone wishes to do so 
  28. // and upload the result, please be my guest. This would also make it 
  29. // easier to include each in an appropriately sized bounding sphere as 
  30. // part of the definition.  Unfortunately, I think this would probably 
  31. // break my sample file so it would have to be reworked also.  Rather than 
  32. // continue to hold back until some possible future time when the thing is 
  33. // perfect, I decided to release it with all its warts now, in the hopes
  34. // that someone may find it useful.
  35. //
  36.  
  37. #declare al_base = intersection {
  38.     plane { <-1 0 0> 0  }
  39.     plane { <1 0 0> 5  }
  40.     plane { <0 1 0> 5  }
  41.     plane { <0 -1 0> 0  }
  42.  }
  43.  
  44. #declare al_bot_clip = intersection {
  45.     plane { <1 0 0> 4  }
  46.     plane { <-1 0 0> -1  }
  47.     plane { <0 1 0> 2  }
  48.  }
  49.  
  50. #declare al_top_clip = intersection {
  51.     plane { <1 0 0> 4  }
  52.     plane { <-1 0 0> -1  }
  53.     plane { <0 -1 0> -3  }
  54.  }
  55.  
  56. #declare al_left_clip = intersection {
  57.     plane { <1 0 0> 2  }
  58.     plane { <0 1 0> 4  }
  59.     plane { <0 -1 0> -1  }
  60.  }
  61.  
  62. #declare al_right_clip = intersection {
  63.     plane { <-1 0 0> -3  }
  64.     plane { <0 1 0> 4  }
  65.     plane { <0 -1 0> -1  }
  66.  }
  67.  
  68. #declare al_center_punch = intersection {
  69.     plane { <-1 0 0> -1  }
  70.     plane { <1 0 0> 4  }
  71.     plane { <0 1 0> 4  }
  72.     plane { <0 -1 0> -1  }
  73.  }
  74.  
  75. #declare al_top_punch = intersection {
  76.     plane { <-1 0 0> -1  }
  77.     plane { <1 0 0> 4  }
  78.     plane { <0 1 0> 4  }
  79.     plane { <0 -1 0> -3  }
  80.  }
  81.  
  82. #declare al_bot_punch = intersection {
  83.     plane { <-1 0 0> -1  }
  84.     plane { <1 0 0> 4  }
  85.     plane { <0 1 0> 2  }
  86.     plane { <0 -1 0> -1  }
  87.  }
  88.  
  89. #declare al_tl_out_corner = intersection {
  90.     quadric { Cylinder_Z inverse translate <1 4 0>  }
  91.     plane { <1 0 0> 1  }
  92.     plane { <0 -1 0> -4  }
  93.  }
  94.  
  95. #declare al_tr_out_corner = intersection {
  96.     quadric { Cylinder_Z inverse translate <4 4 0>  }
  97.     plane { <-1 0 0> -4  }
  98.     plane { <0 -1 0> -4  }
  99.  }
  100.  
  101. #declare al_bl_out_corner = intersection {
  102.     quadric { Cylinder_Z inverse translate <1 1 0>  }
  103.     plane { <1 0 0> 1  }
  104.     plane { <0 1 0> 1  }
  105.  }
  106.  
  107. #declare al_br_out_corner = intersection {
  108.     quadric { Cylinder_Z inverse translate <4 1 0>  }
  109.     plane { <-1 0 0> -4  }
  110.     plane { <0 1 0> 1  }
  111.  }
  112.  
  113. #declare al_tl_in_corner = intersection {
  114.     quadric { Cylinder_Z scale <0.5 0.5 1> inverse translate <1.5 3.5 0>  }
  115.     plane { <1 0 0> 1.5  }
  116.     plane { <0 -1 0> -3.5  }
  117.  }
  118.  
  119. #declare al_tr_in_corner = intersection {
  120.     quadric { Cylinder_Z scale <0.5 0.5 1> inverse translate <3.5 3.5 0>  }
  121.     plane { <-1 0 0> -3.5  }
  122.     plane { <0 -1 0> -3.5  }
  123.  }
  124.  
  125. #declare al_bl_in_corner = intersection {
  126.     quadric { Cylinder_Z scale <0.5 0.5 1> inverse translate <1.5 1.5 0>  }
  127.     plane { <1 0 0> 1.5  }
  128.     plane { <0 1 0> 1.5  }
  129.  }
  130.  
  131. #declare al_br_in_corner = intersection {
  132.     quadric { Cylinder_Z scale <0.5 0.5 1> inverse translate <3.5 1.5 0>  }
  133.     plane { <-1 0 0> -3.5  }
  134.     plane { <0 1 0> 1.5  }
  135.  }
  136.  
  137.  
  138. /* now for the letters */
  139.  
  140. #declare al_letter_o = difference {
  141.     intersection { al_base  }
  142.     intersection { al_tl_out_corner  }
  143.     intersection { al_tr_out_corner  }
  144.     intersection { al_bl_out_corner  }
  145.     intersection { al_br_out_corner  }
  146.     difference {
  147.         intersection { al_center_punch  }
  148.         intersection { al_tl_in_corner  }
  149.         intersection { al_tr_in_corner  }
  150.         intersection { al_bl_in_corner  }
  151.         intersection { al_br_in_corner  }
  152.      }
  153.  }
  154.  
  155. #declare al_letter_a = difference {
  156.     intersection { al_base  }
  157.     intersection { al_tl_out_corner  }
  158.     intersection { al_tr_out_corner  }
  159.     intersection { al_bot_clip  }
  160.     difference {
  161.         intersection { al_top_punch  }
  162.         intersection { al_tl_in_corner  }
  163.         intersection { al_tr_in_corner  }
  164.      }
  165.  }
  166.  
  167. #declare al_letter_b = difference {
  168.     intersection { al_base  }
  169.     intersection { al_br_out_corner  }
  170.     intersection { al_tr_out_corner  }
  171.     difference {
  172.         intersection { al_top_punch  }
  173.         intersection {
  174.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  175.                     translate <3.5 3.5 0>  }
  176.             plane { <-1 0 0> -3.5  }
  177.          }
  178.      }
  179.     difference {
  180.         intersection { al_bot_punch  }
  181.         intersection {
  182.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  183.                     translate <3.5 1.5 0>  }
  184.             plane { <-1 0 0> -3.5  }
  185.          }
  186.      }
  187.     intersection {
  188.         quadric { Cylinder_Z scale <0.5 0.5 1> inverse
  189.                 translate <4.5 3 0>  }
  190.         quadric { Cylinder_Z scale <0.5 0.5 1> inverse
  191.                 translate <4.5 2 0>  }
  192.         plane { <-1 0 0> -4.5  }
  193.         plane { <0 1 0> 3  }
  194.         plane { <0 -1 0> -2  }
  195.      }
  196.  }
  197.  
  198. #declare al_letter_c = difference {
  199.     difference { al_letter_o  }
  200.     intersection {
  201.         plane { <-1 0 0> -3  }
  202.         plane { <0 1 0> 3.5  }
  203.         plane { <0 -1 0> -1.5  }
  204.      }
  205.  }
  206.  
  207. #declare al_letter_d = difference {
  208.     intersection { al_base  }
  209.     intersection { al_tr_out_corner  }
  210.     intersection { al_br_out_corner  }
  211.     difference {
  212.         intersection { al_center_punch  }
  213.         intersection { al_tr_in_corner  }
  214.         intersection { al_br_in_corner  }
  215.      }
  216.  }
  217.  
  218. #declare al_letter_e = difference {
  219.     intersection { al_base  }
  220.     intersection { al_top_punch  }
  221.     intersection { al_bot_punch  }
  222.     intersection { al_right_clip  }
  223.  }
  224.  
  225. #declare al_letter_f = difference {
  226.     intersection { al_base  }
  227.     intersection { al_top_punch  }
  228.     intersection { al_right_clip  }
  229.     intersection {
  230.         plane { <-1 0 0> -1  }
  231.         plane { <0 1 0> 2  }
  232.      }
  233.  }
  234.  
  235. #declare al_letter_g = difference {
  236.     intersection { al_base  }
  237.     intersection { al_tl_out_corner  }
  238.     intersection { al_tr_out_corner  }
  239.     intersection { al_bl_out_corner  }
  240.     intersection { al_br_out_corner  }
  241.     difference {
  242.         intersection { al_center_punch  }
  243.         intersection { al_tl_in_corner  }
  244.         intersection { al_tr_in_corner  }
  245.         intersection { al_bl_in_corner  }
  246.         intersection { al_br_in_corner  }
  247.         intersection { 
  248.             plane { <1 0 0> 5  }
  249.             plane { <-1 0 0> -3  }
  250.             plane { <0 1 0> 3  }
  251.             plane { <0 -1 0> -2  }
  252.          }
  253.      }
  254.     intersection {
  255.         plane { <-1 0 0> -3  }
  256.         plane { <0 1 0> 3.5  }
  257.         plane { <0 -1 0> -3  }
  258.      }
  259.  }
  260.  
  261. #declare al_letter_h = difference {
  262.     intersection { al_base  }
  263.     intersection { al_top_clip  }
  264.     intersection { al_bot_clip  }
  265.  }
  266.  
  267. #declare al_letter_i = difference {
  268.     intersection { al_base  }
  269.     intersection { al_right_clip  }
  270.     intersection { al_left_clip  }
  271.  }
  272.  
  273. #declare al_letter_j = difference {
  274.     intersection { al_base  }
  275.     intersection { al_br_out_corner  }
  276.     intersection { al_bl_out_corner  }
  277.     difference {
  278.         intersection { al_center_punch  }
  279.         intersection { al_br_out_corner  }
  280.         intersection { al_bl_out_corner  }
  281.      }
  282.     intersection {
  283.         plane { <1 0 0> 4  }
  284.         plane { <0 -1 0> -2  }
  285.      }
  286.  }
  287.  
  288. #declare al_letter_k = difference {
  289.     intersection { al_base  }
  290.     difference { 
  291.         intersection { al_top_clip  }
  292.         intersection {
  293.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  294.                     translate <3.5 3.5 0>  }
  295.             plane { <-1 0 0> -3.5  }
  296.             plane { <0 1 0> 3.5  }
  297.          }
  298.      }
  299.     difference { 
  300.         intersection { al_bot_clip  }
  301.         intersection {
  302.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  303.                     translate <3.5 1.5 0>  }
  304.             plane { <-1 0 0> -3.5  }
  305.             plane { <0 -1 0> -1.5  }
  306.          }
  307.      }
  308.     intersection {
  309.         quadric { Cylinder_Z scale <0.5 0.5 1> inverse
  310.                 translate <4.5 3 0>  }
  311.         quadric { Cylinder_Z scale <0.5 0.5 1> inverse
  312.                 translate <4.5 2 0>  }
  313.         plane { <-1 0 0> -4.5  }
  314.         plane { <0 1 0> 3  }
  315.         plane { <0 -1 0> -2  }
  316.      }
  317.  }
  318.  
  319. #declare al_letter_l = difference {
  320.     intersection { al_base  }
  321.     intersection { 
  322.         plane { <-1 0 0> -1  }
  323.         plane { <0 -1 0> -1  }
  324.      }
  325.  }
  326.  
  327. #declare al_letter_m = difference {
  328.     intersection { al_base  }
  329.     intersection { al_tl_out_corner  }
  330.     intersection { al_tr_out_corner  }
  331.     difference {
  332.         intersection { 
  333.             plane { <1 0 0> 2  }
  334.             plane { <-1 0 0> -1  }
  335.             plane { < 0 1 0> 4  }
  336.          }
  337.         intersection {
  338.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  339.                     translate <1.5 3.5 0>  }
  340.             plane { <0 -1 0> -3.5  }
  341.          }
  342.      }
  343.     difference {
  344.         intersection { 
  345.             plane { <1 0 0> 4  }
  346.             plane { <-1 0 0> -3  }
  347.             plane { < 0 1 0> 4  }
  348.          }
  349.         intersection {
  350.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  351.                     translate <3.5 3.5 0>  }
  352.             plane { <0 -1 0> -3.5  }
  353.          }
  354.      }
  355.     intersection {
  356.         quadric { Cylinder_Z scale <0.5 0.5 1> inverse
  357.                 translate <2 4.5 0>  }
  358.         quadric { Cylinder_Z scale <0.5 0.5 1> inverse
  359.                 translate <3 4.5 0>  }
  360.         plane { <0 -1 0> -4.5  }
  361.         plane { <1 0 0> 3  }
  362.         plane { <-1 0 0> -2  }
  363.      }
  364.  }
  365.  
  366. #declare al_letter_n = difference {
  367.     intersection { al_base  }
  368.     intersection {
  369.         plane { <1 0 0> 4  }
  370.         plane { <-1 0 0> 0 rotate <0 0 45> translate <1 5 0>  }
  371.      }
  372.     intersection { 
  373.         plane { <-1 0 0> -1  }
  374.         plane { <1 0 0> 0 rotate <0 0 45> translate <1 3 0>  }
  375.      }
  376.  }
  377.  
  378. #declare al_letter_p = difference {
  379.     intersection { al_base  }
  380.     intersection { al_tr_out_corner  }
  381.     intersection {
  382.         quadric { Cylinder_Z inverse translate <4 3 0>  }
  383.         plane { <-1 0 0> -4  }
  384.         plane { <0 1 0> 3  }
  385.      }
  386.     intersection { 
  387.         plane { <-1 0 0> -1  } 
  388.         plane { <0 1 0> 2  }
  389.      }
  390.     difference {
  391.         intersection { al_top_punch  }
  392.         intersection {
  393.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  394.                     translate <3.5 3.5 0>  }
  395.             plane { <-1 0 0> -3.5  }
  396.          }
  397.      }
  398.  }
  399.  
  400. #declare al_letter_q = difference {
  401.     intersection { al_base  }
  402.     intersection { al_tl_out_corner  }
  403.     intersection { al_tr_out_corner  }
  404.     intersection { al_bl_out_corner  }
  405.     intersection { al_br_out_corner  }
  406.     difference {
  407.         intersection { al_center_punch  }
  408.         intersection { al_tl_in_corner  }
  409.         intersection { al_tr_in_corner  }
  410.         intersection { al_bl_in_corner  }
  411.         intersection { al_br_in_corner  }
  412.         intersection { 
  413.             plane { <1 0 0> 3.5  }
  414.             plane { <-1 0 0> -2.5  }
  415.             plane { <0 1 0> 2  }
  416.             plane { <0 -1 0> -1  }
  417.          }
  418.      }
  419.  }
  420.  
  421. #declare al_letter_r = difference {
  422.     intersection { al_base  }
  423.     intersection { al_tr_out_corner  }
  424.     intersection {
  425.         quadric { Cylinder_Z inverse translate <4 3 0>  }
  426.         plane { <-1 0 0> -4  }
  427.         plane { <0 1 0> 3  }
  428.         plane { <0 -1 0> -1.99  }
  429.      }
  430.     difference {
  431.         intersection { 
  432.             plane { <-1 0 0> -1  } 
  433.             plane { <0 1 0> 2  }
  434.          }
  435.         intersection {
  436.             plane { <-1 0 0> 0 rotate <0 0 27> translate <4 0 0>  }
  437.             plane { <1 0 0> 0 rotate <0 0 27> translate <5 0 0>  }
  438.          }
  439.      }
  440.     difference {
  441.         intersection { al_top_punch  }
  442.         intersection {
  443.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  444.                     translate <3.5 3.5 0>  }
  445.             plane { <-1 0 0> -3.5  }
  446.          }
  447.      }
  448.  }
  449.  
  450. #declare al_letter_s = difference {
  451.     intersection { al_base  }
  452.     intersection { al_tl_out_corner  }
  453.     intersection { al_bl_out_corner  }
  454.     intersection { al_br_out_corner  }
  455.     intersection { al_tr_out_corner  }
  456.     difference {
  457.         intersection { al_top_punch  }
  458.         intersection {
  459.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  460.                     translate <3.5 3.5 0>  }
  461.             plane { <-1 0 0> -3.5  }
  462.             plane { <0 -1 0> -3.5  }
  463.          }
  464.         intersection {
  465.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  466.                     translate <1.5 3.5 0>  }
  467.             plane { <1 0 0> 1.5  }
  468.          }
  469.      }
  470.     difference {
  471.         intersection { al_bot_punch  }
  472.         intersection {
  473.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  474.                     translate <3.5 1.5 0>  }
  475.             plane { <-1 0 0> -3.5  }
  476.          }
  477.         intersection {
  478.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  479.                     translate <1.5 1.5 0>  }
  480.             plane { <1 0 0> 1.5  }
  481.             plane { <0 1 0> 1.5  }
  482.          }
  483.      }
  484.     intersection {
  485.         quadric { Cylinder_Z inverse translate <1 3 0>  }
  486.         plane { <1 0 0> 1.01  }
  487.         plane { <0 1 0> 3  }
  488.         plane { <0 -1 0> -1.5  }
  489.      }
  490.     intersection {
  491.         quadric { Cylinder_Z inverse translate <4 2 0>  }
  492.         plane { <-1 0 0> -3.99  }
  493.         plane { <0 1 0> 3.5  }
  494.         plane { <0 -1 0> -2  }
  495.      }
  496.  }
  497.  
  498. #declare al_letter_t = difference {
  499.     intersection { al_base  }
  500.     intersection { 
  501.         plane { <1 0 0> 2  }
  502.         plane { <0 1 0> 4  }
  503.      }
  504.     intersection { 
  505.         plane { <-1 0 0> -3  }
  506.         plane { <0 1 0> 4  }
  507.      }
  508.  }
  509.  
  510. #declare al_letter_u = difference {
  511.     intersection { al_base  }
  512.     intersection { al_bl_out_corner  }
  513.     intersection { al_br_out_corner  }
  514.     difference {
  515.         intersection { 
  516.             plane { <1 0 0> 4  }
  517.             plane { <-1 0 0> -1  }
  518.             plane { <0 -1 0> -1  }
  519.          }
  520.         intersection { al_bl_in_corner  }
  521.         intersection { al_br_in_corner  }
  522.      }
  523.  }
  524.  
  525. #declare al_letter_v = difference {
  526.     intersection { al_base  }
  527.     plane { <1 0 0> 0 rotate <0 0 21.8> translate <2 0 0>  }
  528.     plane { <-1 0 0> 0 rotate <0 0 -21.8> translate <3 0 0>  }
  529.     intersection {
  530.         plane { <-1 0 0> 0 rotate <0 0 21.8> translate <3 0 0>  }
  531.         plane { <1 0 0> 0 rotate <0 0 -21.8> translate <2 0 0>  }
  532.      }
  533.  }
  534.  
  535. #declare al_letter_w = difference {
  536.     intersection { al_base  }
  537.     intersection { al_bl_out_corner  }
  538.     intersection { al_br_out_corner  }
  539.     difference {
  540.         intersection { 
  541.             plane { <1 0 0> 2  }
  542.             plane { <-1 0 0> -1  }
  543.             plane { <0 -1 0> -1  }
  544.          }
  545.         intersection {
  546.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  547.                     translate <1.5 1.5 0>  }
  548.             plane { <0 1 0> 1.5  }
  549.          }
  550.      }
  551.     difference {
  552.         intersection { 
  553.             plane { <1 0 0> 4  }
  554.             plane { <-1 0 0> -3  }
  555.             plane { <0 -1 0> -1  }
  556.          }
  557.         intersection {
  558.             quadric { Cylinder_Z scale <0.5 0.5 1> inverse 
  559.                     translate <3.5 1.5 0>  }
  560.             plane { <0 1 0> 1.5  }
  561.          }
  562.      }
  563.     intersection {
  564.         quadric { Cylinder_Z scale <0.5 0.5 1> inverse
  565.                 translate <2 0.5 0>  }
  566.         quadric { Cylinder_Z scale <0.5 0.5 1> inverse
  567.                 translate <3 0.5 0>  }
  568.         plane { <0 1 0> 0.5  }
  569.         plane { <1 0 0> 3  }
  570.         plane { <-1 0 0> -2  }
  571.      }
  572.     intersection {
  573.         plane { <1 0 0> 4  }
  574.         plane { <-1 0 0> -1  }
  575.         plane { <0 -1 0> -4  }
  576.      }
  577.  }
  578.  
  579. #declare al_letter_x = difference {
  580.     intersection { al_base  }
  581.     intersection {
  582.         plane { <-1 0 0> 0 rotate <0 0 45> translate <6 0 0>  }
  583.         plane { <1 0 0> 0 rotate <0 0 -45> translate <-1 0 0>  }
  584.      }
  585.     intersection {
  586.         plane { <-1 0 0> 0 rotate <0 0 -45> translate <1 0 0>  }
  587.         plane { <1 0 0> 0 rotate <0 0 45> translate <4 0 0>  }
  588.      }
  589.     intersection {
  590.         plane { <1 0 0> 0 rotate <0 0 45> translate <4 0 0>  }
  591.         plane { <1 0 0> 0 rotate <0 0 -45> translate <-1 0 0>  }
  592.      }
  593.     intersection {
  594.         plane { <-1 0 0> 0 rotate <0 0 45> translate <6 0 0>  }
  595.         plane { <-1 0 0> 0 rotate <0 0 -45> translate <1 0 0>  }
  596.      }
  597.  }
  598.  
  599. #declare al_letter_y = difference {
  600.     intersection { al_base  }
  601.     intersection {
  602.         plane { <1 0 0> 0 rotate <0 0 33.7> translate <0 5 0>  }
  603.         plane { <1 0 0> 2  }
  604.      }
  605.     intersection {
  606.         plane { <-1 0 0> 0 rotate <0 0 -33.7> translate <5 5 0>  }
  607.         plane { <-1 0 0> -3  }
  608.      }
  609.     intersection {
  610.         plane { <-1 0 0> 0 rotate <0 0 33.7> translate <1 5 0>  }
  611.         plane { <1 0 0> 0 rotate <0 0 -33.7> translate <4 5 0>  }
  612.      }
  613.  }
  614.  
  615. #declare al_letter_z = difference {
  616.     intersection { al_base  }
  617.     intersection {
  618.         plane { <0 1 0> 4  }
  619.         plane { <1 0 0> 0 rotate <0 0 -45> translate <0 1 0>  }
  620.      }
  621.     intersection { 
  622.         plane { <0 -1 0> -1  }
  623.         plane { <-1 0 0> 0 rotate <0 0 -45> translate <2 1 0>  }
  624.      }
  625.  }
  626.  
  627.