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.

int W.read int(string p) displays a panel with prompt p for integer input, returns<br />

the input.<br />

3.7 Input and output operators<br />

For input and output of basic geometric objects in the plane such as points, lines, line segments,<br />

circles, and polygons the > operators can be used. Similar to C++input<br />

streams windows have an internal state indicating whether there is more input to read or<br />

not. Its initial value is true and it is turned to false if an input sequence is terminated by<br />

clicking the right mouse button (similar to ending stream input by the eof character). In<br />

conditional statements, objects of type window are automatically converted to boolean<br />

by returning this internal state. Thus, they can be used in conditional statements in the<br />

same way as C++input streams. For example, to read a sequence of points terminated by<br />

a right button click, use “ while (W >> p) { . . . } ”.<br />

3.7.1 Output<br />

window& W ≪ const point& p like W .draw point(p).<br />

window&<br />

W ≪ const segment& s<br />

like W .draw segment(s).<br />

window& W ≪ const ray& r like W .draw ray(r).<br />

window& W ≪ const line& l like W .draw line(l).<br />

window&<br />

window&<br />

window&<br />

window&<br />

window&<br />

W ≪ const circle& C like W .draw circle(C).<br />

W ≪ const polygon& P<br />

like W .draw polygon(P ).<br />

W ≪ const gen polygon& P<br />

like W .draw polygon(P ).<br />

W ≪ const rectangle& R<br />

like W .draw rectangle(R).<br />

W ≪ const triangle& T<br />

like W .draw triangle(T ).<br />

3.7.2 Input<br />

window& W ≫ point& p reads a point p: clicking the left button assigns the<br />

current cursor position to p.

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

Saved successfully!

Ooh no, something went wrong!