\manpage {rat\_point} {} {Rational Points} 
 
\definition
An instance of the data type $rat\_point$ is a point with rational coordinates 
in the two-dimensional plane. A point $(a,b)$ is represented by homogeneous
coordinates $(x,y,w)$ of arbitrary length integers (see \ref{Integers of 
Arbitrary Length}) such that $a = x/w$ and $b = y/w$. 
 
\creation p
 
\create { }
   { introduces a variable \var\ of type \name\
initialized to the point $(0,0)$. }
 
 
\create {(integer\ a,\ integer\ b)}
   { introduces a variable \var\ of type \name\
initialized to the point $(a,b)$. }
 
 
\create {(integer\ x,\ integer\ y,\ integer\ w)}
   { introduces a variable \var\ of type \name\
initialized to the point with homogeneous coordinates$(x,y,w)$. }
 
 
\operations 2 3.5 
 
\op  double xcoord {()}
           {  returns a double precision floating point approximation of the
            $x$-coordinate of \var. }
 
 
\op  double ycoord {()}
           {  returns a double precision floating point approximation of the
            $y$-coordinate of \var. }
 
 
\op  integer X {()}
           {  returns the first homogeneous coordinate of \var. }
 
 
\op  integer Y {()}
           {  returns the second homogeneous coordinate of \var. }
 
 
\op  integer W {()}
           {  returns the third homogeneous coordinate of \var. }
 
 
\binop int == {q}
         {  test for equality. }
 
 
\binop int != {q}
         {  test for inequality. }
 
 
\binopfunc  ostream\&   {ostream\&\ O\ << rat\_point\ p}
           {  writes the homogenous coordinates $(x,y,w)$ of \var\ to
                output stream $O$. }
 
 
\binopfunc  istream\&   {istream\&\ I\ >>rat\_point\&\ p}
           {  reads the homogenous coordinates $(x,y,w)$ of \var\ from
                input stream $I$. }
 
 
