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

  1. \bigskip
  2. \bigskip
  3. {\magonebf 6.1.5  Circles (circle)}
  4.  
  5. An instance $C$ of the data type $circle$ is a circle in the two-dimensional 
  6. plane, i.e., the set of points having a certain distance $r$ from a given
  7. point $p$. $r$ is called the radius and $p$ is called the center of $C$.
  8. The circle with center $(0,0)$ and radius $0$ is called the empty circle.
  9.  
  10. \def\name{$circle$}
  11. \def\type{$circle$}
  12.  
  13. {\bf 1. Creation of a circle }
  14.  
  15. a) \create C (point\ p,\ real\ r)
  16.  
  17. b) \create C {}
  18.  
  19.  
  20. introduces a variable $C$ of type $circle$. $C$ is initialized to the circle
  21. with center $p$  and radius $r$.  Variant b) creates the empty circle and
  22. assigns it to $C$.
  23.  
  24.  
  25. \bigskip
  26. {\bf 2. Operations on a circle C}
  27.  
  28. \medskip
  29. \+\cleartabs & \hskip 2.5truecm & \hskip 5truecm &\cr
  30. \+\op real         radius {}              
  31.                            {returns the radius of \var.}
  32. \smallskip
  33. \+\op point        center {}              
  34.                            {returns the center of \var.}
  35. \smallskip
  36. \+\op list(point)  intersection {line\ l}
  37.                            {returns $C \cap l$ as a list of points.}
  38. \smallskip
  39. \+\op list(point)  intersection {segment\ s}
  40.                            {returns $C \cap s$ as a list of points.}
  41. \smallskip
  42. \+\op list(point)  intersection {circle\ D}
  43.                            {returns $C \cap D$ as a list of points.}
  44. \smallskip
  45. \+\op segment      left\_tangent {point\ p}
  46.                            {returns the line segment starting in $p$ tangent}
  47. \+\nop                     {to \var\ and left of segment $[p,C.center()]$.}
  48. \smallskip
  49. \+\op segment      right\_tangent {point\ p}
  50.                            {returns the line segment starting in $p$ tangent}
  51. \+\nop                     {to \var\ and right of segment $[p,C.center()]$.}
  52. \smallskip
  53. \+\op real         distance {point\ p}
  54.                            {returns the distance between \var\ and $p$}
  55. \+\nop                     {(negative if $p$ inside \var).}
  56. \smallskip
  57. \+\op real         distance {line\ l}
  58.                            {returns the distance between \var\ and $l$ }
  59. \+\nop                     {(negative if $l$ intersects \var).}
  60. \smallskip
  61. \+\op real         distance {circle\ D}
  62.                            {returns the distance between \var\ and $D$}
  63. \+\nop                     {(negative if $D$ intersects \var).}
  64. \smallskip
  65. \+\op bool          inside {point\ p}
  66.                            {returns true if $P$ lies inside of \var,}
  67. \+\nop                     {false otherwise.}
  68. \smallskip
  69. \+\op bool          outside {point\ p}
  70.                            {returns !\var.inside($p$).}
  71. \smallskip
  72. \+\op circle        translate {vector\ v} 
  73.                            {returns $C+v$, i.e., the circle created by}
  74. \+\nop                     {translating $C$ by vector $v$. \precond }
  75. \+\nop                     {$v$.dim = 2.}
  76. \smallskip
  77. \+\op circle        translate {real\ \alpha,\ real\ d} {}
  78. \+\nop                  {returns the circle created by a translation of $C$}
  79. \+\nop                  {in direction $\alpha$ by distance $d$.}
  80. \smallskip
  81. \+\op circle        rotate {point\ q,\ real\ \alpha}
  82.                           {returns the circle created by a rotation of $C$}
  83. \+\nop                    {about point $q$ by angle $\alpha$.}
  84. \smallskip
  85.  
  86. \bigskip
  87. {\bf 3. Operators }
  88. \medskip
  89. \+&$circle\&$ &$circle$ =\ \  $circle$    &assignment\cr
  90. \smallskip
  91. \+&$bool$     &$circle$ ==    $circle$    &test for equality\cr
  92. \smallskip
  93. \+&$bool$     &$circle$\ !=\  $circle$    &test for inequality\cr
  94.  
  95.