Drawing shapes along an svgwrite path

I do not have any experience with svgwrite. I will give you just a generic idea.

If you draw your curved line as

  • a sequence of cubic Bézier curve segments
  • and place centers of the shapes just at the boundaries of the segments

Then by definition at the points of those boundaries (marked by arrows below) you will know both:

  • the coordinates
  • tangent (inclination) of the curve
    Because that is the information you provide to define the whole curve.

image

This gives you all the information to correctly place and rotate your shapes.

You can play with such a chain of cubic Bézier curves here:
https://math.hws.edu/eck/cs424/notes2013/canvas/bezier.html

Just check “Lock Control Point Pairs”. My illustration comes from there.