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.

15.4 Sets of Parallel Segments ( segment set )<br />

1. Definition<br />

An instance S of the parameterized data type segment set is a collection of items<br />

(seg item). Every item in S contains as key a line segment with a fixed direction α (see<br />

data type segment) and an information from data type I, called the information type of<br />

S. α is called the orientation of S. We use to denote the item with segment s and<br />

information i. For each segment s there is at most one item ∈ S.<br />

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

2. Creation<br />

segment set S;<br />

creates an empty instance S of type segment set with orientation<br />

zero, i.e., horizontal segments.<br />

segment set S(int rot);<br />

segment set S(double a);<br />

creates an empty instance S of type segment set with orientation<br />

rot · π/2.<br />

creates an empty instance S of type segment set with orientation<br />

a. (Note that there may be incorrect results due to rounding<br />

errors.)<br />

3. Operations<br />

segment S.key(seg item it) returns the segment of item it.<br />

Precondition: it is an item in S.<br />

const I& S.inf(seg item it) returns the information of item it.<br />

Precondition: it is an item in S.<br />

seg item S.insert(const segment& s, const I& i)<br />

seg item S.lookup(const segment& s)<br />

list S.intersection(const segment& q)<br />

associates the information i with segment s. If<br />

there is an item in S then j is replaced<br />

by i, else a new item is added to S. In<br />

both cases the item is returned.<br />

returns the item with segment s (nil if no such<br />

item exists in S).<br />

returns all items ∈ S with s ∩ q ≠ ∅.<br />

Precondition: q is orthogonal to the segments in<br />

S.

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

Saved successfully!

Ooh no, something went wrong!