1

i'm creating a project that is simulating a directed/undirected graph. I faced an issue with presenting properly the weight on the edge , especially when there is 2 edges ( for example edge from A to B and from B to A) and when I'm dragging one of the nodes. I implemented this basically with 2 circles (nodes) that has 2 polygons (edges) between them and trying to write on the each polygon line the edge weight, each edge has the start and end point attributes , I'm calculating the middle of the line and blitting the text in the middle, it means on each rotation/movement of one of the nodes the center needs to be calculated dynamically and display the weight with the same angle as the polygon has, the problem is not just to center the text (which is centered), it's making the weight be exactly on the line in every movement/rotation.

the problem As you can see its not working properly , I think there is a mathematical way to solve it, seeking for any help that I can find, thanks a lot !

Rabbid76
  • 202,892
  • 27
  • 131
  • 174

0 Answers0