I'm working on a shortest-route finder program and I've gotten most of it to work. However, to verify my results, there is currently a tedious amount of manual drawing and calculating required because I can't visually inspect my results as I don't know how to plot them using C++. I've looked around but found mostly math function plotters which only accept an X-range and a Y-function as input, while I simply wish to plot them based on X and Y coordinates. Is there such a function, or a library to support this?
The minimal requirements are very limited: as long as I can plot the points, I'm completely satisfied. If I can choose colours for separate points, that would also help me. In the best scenario, I'd also love a way to visually "connect the dots" so I can plot the actual routes rather than just the points it consists of.
If anyone can point me towards a library or built-in function that can help me with this, I'd be incredibly happy.
Graphics in C++ is not usually very trivial. You might want to play with a wish interpreter instead, and use a canvas object to plot your stuff. For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
package require Tk
canvas .c -bg white
pack .c -fill both -expand yes
# plot from (10 10) to (50 50) using an orange color
.c create line 10 10 50 50 -fill #FF5500
# here's a list of points we'll plot in green
set pts {
100 10
200 10
100 110
200 110
}
.c create line $pts -fill darkgreen
Thank you both for your answers. Duoas' option seems the easiest, so I'll read up on that and see if it's sufficient. I'll keep GraphViz in mind for more advanced uses, in case I need it.
I'll post back here to let you know how it worked out!