home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / diverses / leda / man / polygon.tex < prev    next >
Encoding:
Text File  |  1991-11-15  |  2.8 KB  |  86 lines

  1. \bigskip
  2. \bigskip
  3. {\magonebf  6.1.4 Polygons (polygon)}
  4.  
  5. An instance $P$ of the data type $polygon$ is a simple polygon 
  6. in the two-dimensional plane defined by the sequence of its vertices
  7. in clockwise order. The number of vertices is called the size 
  8. of $P$. A polygon with empty vertex sequence is called empty.
  9.  
  10. \def\name{$polygon$}
  11. \def\type{$polygon$}
  12.  
  13. {\bf 1. Creation of a polygon }
  14.  
  15. a) \create P (list(point)\  pl)
  16.  
  17. b) \create P {}
  18.  
  19.  
  20. introduces a variable \var\ of type \name. \var is initialized to the
  21. polygon with vertex sequence $pl$. \precond The vertices in $pl$ are given 
  22. in clockwise order and define a simple polygon.  Variant b) creates the empty 
  23. polygon and assings it to \var.
  24.  
  25.  
  26. \bigskip
  27. {\bf 2. Operations on a polygon P}
  28.  
  29. \medskip
  30. \+\cleartabs & \hskip 2.5truecm & \hskip 5truecm &\cr
  31. \+\op list(point)   vertices {}
  32.                            {returns the vertex sequence of \var.}
  33. \smallskip
  34. \+\op list(segment) segments {}
  35.                            {returns the sequence of bounding segments of}
  36. \+\nop                     {\var in clockwise order.}
  37. \smallskip
  38. \+\op list(point)   intersection {line\ l}
  39.                            {returns $P \cap l$ as a list of points.}
  40. \smallskip
  41. \+\op list(point)   intersection {segment\ s}
  42.                            {returns $P \cap s$ as a list of points.}
  43. \smallskip
  44. \+\op list(polygon) intersection {polygon\ Q}
  45.                            {returns $P \cap Q$ as a list of points.}
  46. \smallskip
  47. \+\op bool          inside {point\ p}
  48.                            {returns true if $p$ lies inside of $P$,}
  49. \+\nop                     {false otherwise.}
  50. \smallskip
  51. \+\op bool          outside {point\ p}
  52.                            {returns !\var.inside($p$).}
  53. \smallskip
  54. \+\op polygon       translate {vector\ v} {}
  55. \+\nop                     {returns $P+v$, i.e., the polygon created by}
  56. \+\nop                     {translating $P$ by vector $v$. \precond $v$}
  57. \+\nop                     {has dimension 2.}
  58. \smallskip
  59. \+\op polygon       translate {real\ \alpha,\ real\ d} {}
  60. \+\nop                    {returns the polygon created by a translation of }
  61. \+\nop                    {of \var\ in direction $\alpha$ by distance $d$}
  62. \smallskip
  63. \+\op polygon       rotate {point\ q,\ real\ \alpha}
  64.                           {returns the polygon created by a rotation of $P$}
  65. \+\nop                    {about point $q$ by angle $\alpha$.}
  66. \smallskip
  67. \+\op real          size {}
  68.                            {returns the size of \var.}
  69. \smallskip
  70. \+\op real          empty {}
  71.                            {returns true if \var\ is empty, false otherwise.}
  72. \smallskip
  73.  
  74. \vfill\eject
  75.  
  76. \bigskip
  77. {\bf 3. Operators }
  78. \medskip
  79. \+&$polygon\&$  &$polygon$ =\ \  $polygon$     &assignment\cr
  80. \smallskip
  81. \+&$bool$       &$polygon$ ==    $polygon$     &test for equality\cr
  82. \smallskip
  83. \+&$bool$       &$polygon$\ !=\  $polygon$     &test for inequality\cr
  84.  
  85.  
  86.