I’m looking for pointers to algorithms that will help with automatically positioning a label on a polyline.
In this specific case the polyline is defined as a series of [x,y] points. The first point is the origin, the last point is the destination. A line between two points is always straight (ie. not a curve/arc/bezier).
Currently I’m picking the “middle” line segment and positioning the label at the middle of that segment.
This can leads to odd label placements unless each line segment is roughly the same length. If one line segment is much longer then the label “looks odd”.
So… any thoughts on what I should be googling for?
Thanks!
Inspired by Petar Ivanov’s comment: