home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / Pascal / TURTLE10.ZIP / TURTLE.DOC < prev    next >
Encoding:
Text File  |  1992-12-16  |  6.9 KB  |  173 lines

  1. File name               : TURTLE10.ZIP
  2. One line description    : unit that allows turtle graphics in any BGI mode
  3. Author or company       : Dr Patrick L.Pollet
  4. Email address           : ppollet@cismibm.univ-lyon1.fr
  5. Surface address         : Institut National des Sciences Appliquées
  6.                           Centre informatique du 1er Cycle    Bat 110
  7.                           20 avenue A.Einstein
  8.                           69621  Villeurbanne Cedex France
  9. Special requirements    :EGA card minimum
  10. Shareware payment required from private users     : None
  11. Shareware payment required from corporates        : None
  12. Demo:        No
  13. Nagware: No
  14. Self-documenting:  Hopefully
  15. External documentation included:  yes
  16. Source included:   yes
  17. Size: 30150 bytes (Zipped Pkzip 1.10)
  18.  
  19. 10 lines description:
  20.     This unit allows to re-use the Turtle graphics calls in
  21. any graphic mode supported by a BGI driver
  22.     This unit exports all turtle graphics calls present in
  23. TurboPascal V3.0 and in compatibility unit Graph3 provided
  24. with subsequent versions.
  25.     The HiRes and Graphmode calls are not supported  and were
  26. replaced by more general calls
  27. (GraphOn,GraphOff) to accept all standard graphic modes and
  28. drivers.
  29.  
  30.  
  31. Long description:
  32.  
  33. TURTLE  version 1.1e  Unit that allows turtle graphics in any BGI mode
  34.  
  35.   Copyright (c) P.Pollet 1991,1992
  36.   Portions of SVGA handling copyright (c) 1992 J.P.Hardgrave
  37.   Procedures and Functions names (c) Borland Int'l  1987-1992
  38.  
  39. This unit is hereby donated to the public domain provided:
  40.     - the copyright notices are not removed nor modidied.
  41.     - proper citation of authors is made upon usage in other packages
  42.     - the archive contents is not modified
  43.  
  44. Please report all problems, bugs, suggested modifications to the author
  45.  
  46. Dr Patrick L.Pollet     ppollet@cismibm.univ-lyon1.fr
  47. Institut National des Sciences Appliquées
  48. Centre informatique du 1er Cycle    Bat 110
  49. 20 avenue A.Einstein
  50. 69621  Villeurbanne Cedex France
  51.  
  52. Archive contents:
  53.  
  54. TURTLE   DOC      This file
  55. DRAGRECT PAS      2411 14.12.92   10:17Demo program Clover dragon
  56. FOREST   PAS      3737 14.12.92   10:44Demo program draw a nice forest
  57. NICETREE PAS      3124 14.12.92   10:45Demo program Draw a nice tree
  58. SVGA     INI      3192 14.12.92   10:31Include file to use SVGA.BGI
  59. SVGAREG  DOC      3122 14.12.92   10:27Registration form for SVGA.BGI
  60. SVGA256  BGI      6335 09.09.92    9:11SVGA.BGI driver (C) J.Hardgrave
  61. TREEREC  PAS      1539 14.12.92    9:55Demo program Regular trees
  62. TURTLE   PAS     24153 14.12.92   10:30Source code unit Turtle
  63. TURTLEDM PAS      4576 14.12.92   10:05Demo program Play with turtle
  64. VONKOCH  PAS      1977 14.12.92   10:29Demo program Von Koch SnowFlake
  65.  
  66.  
  67. Why did I wrote that unit ?
  68.  
  69.     Do you remember that little turtle with a pen at the tail
  70. that was the main feature of the Logo language ? A toy to
  71. learn computers to kids ??? Well not so...
  72.  
  73.     For my fellow teachers in C.S., turtle graphics are an
  74. exellent introduction to recursion , with  quite attractive
  75. visual effects. Drawing "dragon curves " (Von Koch snowflake,
  76. Peano's curves...) is so natural with this little friendly
  77. animal....
  78.  
  79.     Another application is in the representation of 2D shapes
  80. by relative motions of the turtle  ; that by a couple (
  81. distance, angle ) from a previous point.  This makes the
  82. manipulation of the shape much easier than with the standard
  83. cartesian coordinates representation.  A translation just
  84. requires changing the starting point of the drawing ;
  85. rotations can be obtained by changing the turtle heading and
  86. zooming is done by changing the pixel/distance ratio for the
  87. turtle motions.  Nearly no trigonometric calculations are
  88. required to transform a shape ...
  89.  
  90.     Borland had introduced  turtle graphics with TurboPascal 3.
  91. In the subsequent versions, a compatibilt unit, TURBO3 was
  92. provided but, even with version 6, it can only do turtle
  93. graphics in the old CGA graphic modes !!! Quite desappointing
  94. at the era of SVGA boards....
  95.  
  96.     This  unit , TURTLE.PAS  make possible the use of a turtle
  97. with any graphic mode supported by the Graph unit.  whether it
  98. is a standard graphic mode (EGAVGA,HERC,IBM8570..) or a user
  99. written BGI driver such at the remarkable shareware SVGA
  100. drivers written by .......
  101.  
  102.     To allow a nearly direct recompilation of previous
  103. programs, the entries points are identical , in names and
  104. parameters with the Turbo3 unit interface.
  105.  
  106. technical notes:
  107.  
  108.     This unit has been tested with all  BGI drivers supplied
  109. by Borland Int'l in Turbopascal packages version 5.5  and 6.
  110.  
  111.     User installed BGI drivers were tested only with SVGA.BGI
  112. driver of J.P.Hardgrave.
  113.  
  114.     The source code is self-documented.
  115.  
  116.     Since turtle graphics are done using the LineTo,moveTo
  117. calls to GRAPH, the current point of the graph unit is
  118. synchronized with the turle position. It is therfore possible
  119. to mix turtle graphics and standard BGI graphics. However,
  120. since the turtle is drawn in XOR mode, if a BGI drawn line
  121. cross the turtle image between two moves of the turtle, the
  122. screen image at the turtle previous position  will not be
  123. correctly redrawn   The problem is similar to the handling of
  124. a mouse in text or graphic mode. One has to hide the turtle
  125. before any screen access  and to show it back later.
  126.  
  127.  We have tried to make this transparent as follow:
  128.  
  129. To make the Graph unit "turtle-aware ", our solution is to
  130. redefine in the TURTLE unit all screen accessing BGI calls .
  131. Each BGI call has exactly the same name and parmeter that the
  132. original call and simply hides the turtle before calling the
  133. entry point in the Graph unit and show again the turtle upon
  134. return.
  135.  
  136.    as a exemple the procedure LineTo is redefined as follow :
  137.  
  138.       Procedure LineTo (X,Y:integer);
  139.        begin
  140.         _HideTurtle;       (* Hide turtle if visible *)
  141.         Graph.lineTo(X,Y); (* call the original BGI driver d'ont
  142.                               forget the Graph. qualifier !!!*)
  143.         _ShowTurtle;       (* show turtle if was  visible *)
  144.        end;
  145.  
  146.            With  subsequent versions of the GRAPH unit, you
  147. may have to include in the TURTLE unit similar redefinitions
  148. of new screen drawing calls.
  149.  
  150.     For this  redefinition to work you *must make sure * that
  151. the TURTLE unit is cited *after* the GRAPH unit in the USES
  152. clauses of your client programs.
  153.  
  154.  
  155.     In the initialization process , we redefine the EGAVGA
  156. palette for a better rendition of the 16 colors. With others
  157. drivers, you may have to adjust the content of the typed
  158. contant EGAPALETTE.
  159.  
  160.     To allow "faster trigonometric calculations " we used a
  161. table look up of sines between 0 and 359 degrees. This table
  162. was produced but printing to a text file the result of
  163. 10000*Sin(A/PI*180) and subsequent editing.
  164.  
  165.  
  166. A ThinkPascal version (for MacIntosh with BW  Quickdraw calls
  167. ) is available from the author and could be also placed in the
  168. public domain if enough requests are made....
  169.  
  170.  
  171.  
  172.  
  173.