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.

14.24 Geometry Algorithms ( geo alg )<br />

All functions listed in this section work for geometric objects based on both floating-point<br />

and exact (rational) arithmetic. In particular, point can be replace by rat point, segment<br />

by rat segment, and circle by rat circle.<br />

<strong>The</strong> floating point versions are faster but unreliable. <strong>The</strong>y may produce incorrect results,<br />

abort, or run forever. Only the rational versions will produce correct results for all inputs.<br />

<strong>The</strong> include-file for the rational version is rat geo alg.h, the include-file for the floating<br />

point version is float geo alg.h, and geo alg.h includes both versions. Including both<br />

versions increases compile time. An alternative name for geo alg.h is plane alg.h.<br />

• Convex Hulls<br />

list CONVEX HULL(const list& L)<br />

CONVEX HULL takes as argument a list of points and returns the polygon<br />

representing the convex hull of L. <strong>The</strong> cyclic order of the vertices<br />

in the result list corresponds to counter-clockwise order of the vertices<br />

on the hull. <strong>The</strong> algorithm calls our current favorite of the algorithms<br />

below.<br />

polygon CONVEX HULL POLY(const list& L)<br />

as above, but returns the convex hull of L as a polygon.<br />

list UPPER CONVEX HULL(const list& L)<br />

returns the upper convex hull of L.<br />

list LOWER CONVEX HULL(const list& L)<br />

returns the lower convex hull of L.<br />

list CONVEX HULL S(const list& L)<br />

as above, but the algorithm is based on the sweep paradigm. Running<br />

time is O(n log n) in the worst and in the best case.<br />

list CONVEX HULL IC(const list& L)<br />

as above, but the algorithm is based on incremental construction. <strong>The</strong><br />

running time is O(n 2 ) worst case and is O(n log n) expected case. <strong>The</strong><br />

expectation is computed as the average over all permutations of L. <strong>The</strong><br />

running time is linear in the best case.<br />

list CONVEX HULL RIC(const list& L)<br />

as above. <strong>The</strong> algorithm permutes L randomly and then calls the preceding<br />

function.

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

Saved successfully!

Ooh no, something went wrong!