I have a line with a start point (x1, y1) and an end point (x2, y2), and I want to draw a number of shapes evenly spaced along that line. The number of shapes will vary, however. For example, here's a very rough approximation of what I want. The line with three dots drawn:
Code: . . .
____________
But that same line could be drawn with 7 dots:
Code:. . . . . . .
____________
Of course, if the line were horizontal at all times, this would be easy (a matter of dividing the line length by the # of shapes), but its end points will be moving, so the line's length and angle will be changing. So I need a way to calculate, with each frame, where to place the shapes, given the line's start and end points, and the # of shapes.
I think this involves trigonometry, but maybe there's a simpler way. How can I loop through each shape and get the x/y value for where to plot it, each one further out along the line?
Thanks in advance for your ideas!