1

I have a map with many polygons. I want to do a pathfinding with the "center" of these polygones. So I try to use Lemon Graph Library in order to generate my graph and the Dijkstra 's algorithm.

I see in the Lemon Tutorial :

 ListDigraph g;
 ListDigraph::Node u = g.addNode();
 ListDigraph::Node v = g.addNode();
 ListDigraph::Arc  a = g.addArc(u, v);

My question is : How can I add coordinates in a Node ?

Like :

ListDigraph::Node u = g.addNode(sf::Vector2f(10, 12));
Artem Zankovich
  • 2,319
  • 20
  • 36
Bob
  • 589
  • 1
  • 11
  • 25

1 Answers1

0

You have to include the lemon/dim2.h header file and a ListDigraph::NodeMap. For example, to assign coordinate values to your nodes you would do this:

ListDigraph g;
ListDigraph::NodeMap<dim2::Point<int>> coord(g);

ListDigraph::Node node1 = g.addNode();
coord[node1].x = 0;
coord[node1].y = 0;
Seth
  • 11
  • 3