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.

double r.direction( ) returns the direction of r.<br />

double r.angle(const ray& s) returns the angle between r and s, i.e.,<br />

s.direction() − r.direction().<br />

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

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

double r.slope( ) returns the slope of the straight line underlying r.<br />

Precondition: r is not vertical.<br />

bool<br />

bool<br />

r.intersection(const ray& s, point& inter)<br />

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

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

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

the result is false.<br />

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

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

the result is false.<br />

ray r.translate by angle(double a, double d)<br />

returns r translated in direction a by distance d.<br />

ray<br />

r.translate(double dx, double dy)<br />

returns r translated by vector (dx, dy).<br />

ray r.translate(const vector& v)<br />

returns r translated by vector v<br />

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

ray r + const vector& v returns r translated by vector v.<br />

ray r − const vector& v returns r translated by vector −v.<br />

ray r.rotate(const point& q, double a)<br />

returns r rotated about point q by angle a.<br />

ray r.rotate(double a) returns r.rotate(point(0, 0), a).<br />

ray r.rotate90(const point& q, int i = 1)<br />

ray r.reflect(const point& p, const point& q)<br />

returns r rotated about q by an angle of i × 90<br />

degrees. If i > 0 the rotation is counter-clockwise<br />

otherwise it is clockwise.<br />

returns r reflected across the straight line passing<br />

through p and q.

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

Saved successfully!

Ooh no, something went wrong!