\manpage {circle} {} {Circles}  
 
\definition
An instance $C$ of the data type $circle$ is a circle in the two-dimensional
plane, i.e., the set of points having a certain distance $r$ from a given
point $p$. $r$ is called the radius and $p$ is called the center of $C$.
The circle with center $(0,0)$ and radius $0$ is called the empty circle.
 
\creation C  
 
\create {(point\ c,\ double\ r)}
   { introduces a variable $C$ of type $circle$. $C$ is initialized to
             the circle with center $c$ and radius $r$. }
 
 
\create {(double\ x,\ double\ y,\ double\ r)}
   { introduces a variable $C$ of type $circle$. $C$ is initialized to
             the circle with center $(x,y)$ and radius $r$. }
 
 
\create { }
   { introduces a variable $C$ of type $circle$. $C$ is initialized to
             the empty circle. }
 
 
\operations 2.2 4.7 
 
\op  point center {()}
           {  returns the center of \var. }
 
 
\op  double radius {()}
           {  returns the radius of \var. }
 
 
\op  list\<point\> intersection {( circle\ D)}
           {  returns $C \cap D$ as a list of points. }
 
 
\op  list\<point\> intersection {( line\ l)}
           {  returns $C \cap l$ as a list of points. }
 
 
\op  list\<point\> intersection {( segment\ s)}
           {  returns $C \cap s$ as a list of points. }
 
 
\op  segment left\_tangent {( point\ p)}
           {  returns the line segment starting in $p$ tangent
	  to \var\ and left of segment $[p,C.center()]$. }
 
 
\op  segment right\_tangent {( point\ p)}
           {  returns the line segment starting in $p$ tangent
	  to \var\ and right of segment $[p,C.center()]$. }
 
 
\op  double distance {( point\ p)}
           {  returns the distance between \var\ and $p$
	  (negative if $p$ inside \var). }
 
 
\op  double distance {( line\ l)}
           {  returns the distance between \var\ and $l$
	   (negative if $l$ intersects \var). }
 
 
\op  double distance {( circle\ D)}
           {  returns the distance between \var\ and $D$
	   (negative if $D$ intersects \var). }
 
 
\op  bool inside {( point\ p)}
           {  returns true if $p$ lies inside of \var,
	  false otherwise. }
 
 
\op  bool outside {( point\ p)}
           {  returns !\var.inside($p$). }
 
 
\opl circle translate {(double\ a, double\ d)}
           {  returns the circle created by a translation of
	    $C$ in direction $a$ by distance $d$. }
 
 
\op  circle translate {( vector\ v)}
           {  returns $C+v$, i.e., the circle created by
	   translating $C$ by vector $v$.\\
	   \precond
	   $v$.dim() = 2. }
 
 
\opl circle rotate {( point\ q, \ double\ a)}
           {  returns the circle created by a rotation of $C$
	    about point $q$ by angle $a$. }
 
 
\opl circle rotate {(double\ a)}
           {  returns the circle created by a rotation of $C$
	    about the origin by angle $a$. }
 
 
\binop bool == {D}
         {  Test for equality. }
 
 
\binop bool != {D}
         {  Test for inequality. }
 
 
