\manpage {point} {} {Points}
 
\definition
An instance of the data type $point$ is a point in the two-dimensional
plane $\real^2$. We use $(a,b)$ to denote a point with first (or x-)
coordinate $a$ and second (or y-) coordinate $b$.
 
\creation p 
 
\create { }
   { introduces a variable \var\ of type \name\ initialized
            to the point $(0,0)$. }
 
 
\create {(double\ x,\ double\ y)}
   { introduces a variable \var\ of type \name\ initialized to the point
    $(x,y)$. }
 
 
\create {(vector\ v)}
   { introduces a variable \var\ of type \name\ initialized to the point
    $v$. }
 
 
\operations 2 4
 
\op  double  xcoord {()}
           {  returns the first coordinate of \var. }
 
 
\op  double  ycoord {()}
           {  returns the second coordinate of \var. }
 
 
\op  double distance {( point\ q)}
           {  returns the Euclidean distance between \var\ and $q$. }
 
 
\op  double  distance {()}
           {  returns the Euclidean distance between \var\ and $(0,0)$. }
 
 
\opl point translate {(double\ a, double\ d)}
           {  returns the point created by translating
	    \var\ in direction $a$ by distance $d$. The  
	    direction is given by its angle with a 
	    right oriented horizontal ray. }
 
 
\op  point translate {( vector\ v)}
           {  returns \var$+v$, i.e., \var\ translated by vector
	    $v$.\\
	    \precond $v$.dim() = 2. }
 
 
\opl point rotate {( point\ q, double\ a)}
           {  returns the point created by a rotation of \var\
	    about point $q$ by angle $a$. }
 
 
\op  point rotate {(double\ a)}
           {  returns \var.rotate($point(0,0),\ a$).  }
 
 
\binop int == { }
         {  Test for equality. }
 
 
\binop int != {p}
         {  Test for inequality. }
 
 
\binop point + { vector\ v}
         {  Translation by vector $v$. }
 
 
\binopfunc  ostream\&   {ostream\&\ O\ <<p}
           {  writes \var\ to output stream $O$. }
 
 
\binopfunc  istream\&   {istream\&\ I\ >>\&\ p}
           {  reads the coordinates of \var\ (two $double$ numbers)
	        from input stream $I$. }
 
 
