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.11 Rational Segments ( rat segment )<br />

1. Definition<br />

An instance s of the data type rat segment is a directed straight line segment in the twodimensional<br />

plane, i.e., a line segment [p, q] connecting two rational points p and q (cf.<br />

14.10). p is called the source or start point and q is called the target or end point of s. A<br />

segment is called trivial if its source is equal to its target.<br />

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

2. Types<br />

rat segment :: coord type<br />

rat segment :: point type<br />

rat segment :: float type<br />

the coordinate type (rational).<br />

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

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

3. Creation<br />

rat segment s;<br />

introduces a variable s of type rat segment. s is initialized to<br />

the empty segment.<br />

rat segment s(const rat point& p, const rat point& q);<br />

introduces a variable s of type rat segment. s is initialized to<br />

the segment [p, q].<br />

rat segment s(const rat point& p, const rat vector& v);<br />

introduces a variable s of type rat segment. s is initialized to<br />

the segment [p, p + v].<br />

Precondition: v.dim() = 2.<br />

rat segment s(const rational& x1 , const rational& y1 , const rational& x2 ,<br />

const rational& y2 );<br />

introduces a variable s of type rat segment. s is initialized to<br />

the segment [(x1, y1), (x2, y2)].<br />

rat segment s(const integer& x1 , const integer& y1 , const integer& w1 ,<br />

const integer& x2 , const integer& y2 , const integer& w2 );<br />

introduces a variable s of type rat segment. s is initialized to<br />

the segment [(x1, y1, w1), (x2, y2, w2)].<br />

rat segment s(const integer& x1 , const integer& y1 , const integer& x2 ,<br />

const integer& y2 );<br />

introduces a variable s of type rat segment. s is initialized to<br />

the segment [(x1, y1), (x2, y2)].

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

Saved successfully!

Ooh no, something went wrong!