31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

14.12 Rational Rays ( rat ray )<br />

1. Definition<br />

An instance r of the data type rat ray is a directed straight ray defined by two points<br />

with rational coordinates in the two-dimensional plane.<br />

#include < <strong>LEDA</strong>/geo/rat ray.h ><br />

2. Types<br />

rat ray :: coord type<br />

rat ray :: point type<br />

rat ray :: float type<br />

the coordinate type (rational).<br />

the point type (rat point).<br />

the corresponding floatin-point type (ray).<br />

3. Creation<br />

rat ray r(const rat point& p, const rat point& q);<br />

rat ray r(const rat segment& s);<br />

introduces a variable r of type rat ray. r is initialized to the<br />

ray starting at point p and passing through point q.<br />

Precondition: p ≠ q.<br />

introduces a variable r of type rat ray. r is initialized to the<br />

(rat ray(s.source(), s.target()).<br />

Precondition: s is nontrivial.<br />

rat ray r(const rat point& p, const rat vector& v);<br />

introduces a variable r of type rat ray.<br />

rat r ay(p, p + v).<br />

r is initialized to<br />

rat ray r;<br />

introduces a variable r of type rat ray.<br />

rat ray r(const ray& r1 , int prec = rat point :: default precision);<br />

introduces a variable r of type rat ray. r is initialized to the<br />

ray obtained by approximating the two defining points of r 1 .<br />

4. Operations<br />

ray r.to float( ) returns a floating point approximation of r.<br />

void r.normalize( ) simplifies the homogenous representation<br />

by calling point1 ( ).normalize( ) and<br />

point2 ( ).normlize( ).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!