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.15 Rational Triangles ( rat triangle )<br />

1. Definition<br />

An instance t of the data type rat triangle is an oriented triangle in the two-dimensional<br />

plane with rational coordinates. A rat triangle t splits the plane into one bounded and<br />

one unbounded region. If t is positively oriented, the bounded region is to the left of it, if<br />

it is negatively oriented, the unbounded region is to the left of it. t is called degenerate,<br />

if the 3 vertices of t are collinear.<br />

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

2. Types<br />

rat triangle :: coord type<br />

rat triangle :: point type<br />

the coordinate type (rational).<br />

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

3. Creation<br />

rat triangle t;<br />

introduces a variable t of type rat triangle. t is initialized to<br />

the empty triangle.<br />

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

introduces a variable t of type rat triangle. t is initialized to<br />

the triangle [p, q, r].<br />

rat triangle t(const rational& x1 , const rational& y1 , const rational& x2 ,<br />

const rational& y2 , const rational& x3 , const rational& y3 );<br />

introduces a variable t of type rat triangle. t is initialized to<br />

the triangle [(x1, y1), (x2, y2), (x3, y3)].<br />

rat triangle t(const triangle& t, int prec = rat point :: default precision);<br />

4. Operations<br />

introduces a variable t of type rat triangle. t is initialized<br />

to the triangle obtained by approximating the three defining<br />

points of t.<br />

void t.normalize( ) simplifies the homogenous representation by calling<br />

p.normalize( ) for every vertex of t.<br />

rat point t.point1( ) returns the first vertex of triangle t.<br />

rat point t.point2( ) returns the second vertex of triangle t.<br />

rat point t.point3( ) returns the third vertex of triangle t.

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

Saved successfully!

Ooh no, something went wrong!