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.

4. Operations<br />

real point l.point1( ) returns a point on l.<br />

real point l.point2( ) returns a second point on l.<br />

real segment l.seg( ) returns a segment on l.<br />

bool l.is vertical( ) returns true iff l is vertical.<br />

bool l.is horizontal( ) returns true iff l is horizontal.<br />

real l.sqr dist(const real point& q)<br />

real l.distance(const real point& q)<br />

int l.orientation(const real point& p)<br />

returns the square of the distance between l and<br />

q.<br />

returns the distance between l and q.<br />

returns orientation(l.point1(), l.point2(), p).<br />

real l.slope( ) returns the slope of l.<br />

Precondition: l is not vertical.<br />

real l.y proj(real x) returns p.ycoord(), where p ∈ l with p.xcoord() =<br />

x.<br />

Precondition: l is not vertical.<br />

real l.x proj(real y) returns p.xcoord(), where p ∈ l with p.ycoord() =<br />

y.<br />

Precondition: l is not horizontal.<br />

real l.y abs( ) returns the y-abscissa of l (l.y proj(0)).<br />

Precondition: l is not vertical.<br />

bool l.intersection(const real line& g, real point& p)<br />

if l and g intersect in a single point this point is<br />

assigned to p and the result is true, otherwise the<br />

result is false.<br />

bool<br />

l.intersection(const real segment& s, real point& inter)<br />

if l and s intersect in a single point this point is<br />

assigned to p and the result is true, otherwise the<br />

result is false.<br />

bool l.intersection(const real segment& s)<br />

returns true, if l and s intersect, false otherwise.<br />

real line<br />

l.translate(real dx, real dy)<br />

returns l translated by vector (dx, dy).

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

Saved successfully!

Ooh no, something went wrong!