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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

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

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

through q and r.<br />

returns p reflected across point q.<br />

vector p − const point& q returns the difference vector of the coordinates.<br />

Non-Member Functions<br />

int cmp distances(const point& p1 , const point& p2 , const point& p3 ,<br />

const point& p4 )<br />

compares the distances (p1 , p2 ) and (p3 , p4 ). Returns<br />

+1 (−1) if distance (p1 , p2 ) is larger (smaller) than distance<br />

(p3 , p4 ), otherwise 0.<br />

point center(const point& a, const point& b)<br />

point midpoint(const point& a, const point& b)<br />

returns the center of a and b, i.e. a + ⃗ ab/2.<br />

returns the center of a and b.<br />

int orientation(const point& a, const point& b, const point& c)<br />

computes the orientation of points a, b, and c as the<br />

sign of the determinant<br />

∣<br />

a x a y 1<br />

b x b y 1<br />

c x c y 1<br />

∣<br />

i.e., it returns +1 if point c lies left of the directed line<br />

through a and b, 0 if a,b, and c are collinear, and −1<br />

otherwise.<br />

int cmp signed dist(const point& a, const point& b, const point& c,<br />

const point& d)<br />

compares (signed) distances of c and d to the straight<br />

line passing through a and b (directed from a to b). Returns<br />

+1 (−1) if c has larger (smaller) distance than d<br />

and 0 if distances are equal.<br />

double area(const point& a, const point& b, const point& c)<br />

computes the signed area of the triangle determined by<br />

a,b,c, positive if orientation(a, b, c) > 0 and negative<br />

otherwise.

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

Saved successfully!

Ooh no, something went wrong!