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.

ool write postscript(const CONTAINER& c, ps file& ps, color c1 , color c2 )<br />

<strong>The</strong> parameters of these two virtual functions are like the parameters of the members<br />

with the same name of geowin redraw, but there is an additional first parameter. This<br />

parameter is a reference to the container of the scene that has to be redrawn.<br />

In update- and redraw- functions and objects the following static member functions of<br />

the GeoWin class can be used:<br />

GeoWin ∗ GeoWin :: get call geowin( )<br />

geo scene GeoWin :: get call scene( )<br />

geo scene GeoWin :: get call input scene( )<br />

<strong>The</strong> first function returns a pointer to the GeoWin of the calling scene, the second returns<br />

the calling scene and the third (only usable in update functions/ objects) returns the input<br />

scene of the calling scene.<br />

Note that S and R in the following operations are template parameters. S and R have<br />

to be a list, where T is a 2d <strong>LEDA</strong> kernel type, a d3 point or a d3 rat point. S is the<br />

type of the contents of the input scene, R the type of the contents of the created result<br />

scene. All operations creating result scenes return a pointer to the created result scene.<br />

This section contains three small example programs showing you the usage of the<br />

new scene operations for the creation of result scenes. All example programs compute<br />

the convex hull of a set of points stored in the container of an input scene sc points and<br />

store the computed hull in a result scene sc hull.<br />

template <br />

GeoResultScene∗ GW.new scene(void (∗f update)(const S& , R& ), geo scene sc,<br />

string str, D3 FCN f = NULL)<br />

creates a new result scene with name str. <strong>The</strong> input<br />

scene for this new result scene will be sc. <strong>The</strong> update<br />

function will be f update.<br />

<strong>The</strong> first example program shows the usage of the new scene operation taking an update<br />

function pointer. <strong>The</strong> update function computes the convex hull of the points stored in<br />

the input scene. <strong>The</strong> result polygon will be inserted in the container P of the result scene.<br />

#include <br />

#include <br />

using namespace leda;<br />

void convex_hull(const list& L, list& P)<br />

{ P.clear(); P.append(CONVEX_HULL_POLY(L)); }<br />

int main()<br />

{<br />

GeoWin gw;<br />

list LP;

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

Saved successfully!

Ooh no, something went wrong!