Listing 2: Populating the graph during the run of Fortune’s Voronoi algorithm

// this typdef will save us some typing
typedef boost::graph_traits<MAGraph>::vertex_descriptor 
medaxisVertex;

MedialAxisGraph medaxis;

while( /* there are output records */)
{
    switch (/* event code */)
    {
    case 'v':
      // v x y: indicates a vertex at (x, y)
      v = boost::add_vertex(medaxis);
      boost::put(vertex_coord_t(), medaxis, v, Point(x, y));
      boost::put(vertex_insidecurve_t(), medaxis, v, true); 

    case 'e':
      // e l v1 v2: indicates a Voronoi segment between v1 and v2 
      boost::add_edge(static_cast<medaxisVertex>(v1),
                      static_cast<medaxisVertex>(v2),
                      medaxis);

— End of Listing —