Guide > GeoWin > Programming Interface > Example Result Scenes and Update Objects

Example Result Scenes and Update Objects

The following program shows how to use result scenes and update objects of GeoWin. (See also Example Result Scenes and Update Functions.)

The update object convex_hull computes (the polygon of) the convex hull of a set of points in the plane.

The main function defines a GeoWin geow and a list<point> LP. The points are generated using an input scene sc_points of geow. The convex hull is represented by a result scene sc_hull using convex_hull as the update object, sc_points as input scene, and "Convex Hull" as the name of the scene. geo_scene is a typedef for GeoScene*.

The boundary drawing color for sc_hull is set to blue and the scene is made visible.

Finally, geow is opened in interactive mode with edit scene sc_points. (See also Create and Open GeoWin.)

On the right there is a screenshot of the program after adding some points interactively. Clicking on the picture shows the GeoWin in original size.

Picture of GeoWin Edit and Result Scenes
#include <LEDA/graphics/geowin.h>
#include <LEDA/geo/float_geo_alg.h>

using namespace leda;


int main()
{
  GeoWin geow;
  list<point> LP;
 
  geo_scene sc_points = geow.new_scene(LP);  
                //edit scene for input of points
 
  geowin_update<list<point>, list<polygon> > 
             convex_hull(CONVEX_HULL_POLY);

  geo_scene sc_hull = geow.new_scene(convex_hull, 
                          sc_points, "Convex hull");
                //result scene for convex hull

  geow.set_color(sc_hull, blue);
  geow.set_visible(sc_hull, true);
  
  geow.edit(sc_points);

  return 0;
}

See also:

GeoWin

Programming Interface

Interactive Interface

Create and Open GeoWin

Example Result Scenes and Update Functions


Linear Lists


Geometry

Basic Data Types for 2D Geometry


Geometry Algorithms

Convex Hull


Manual Pages:

Manual Page GeoWin




Algorithmic Solutions Software GmbH