I want to draw an ellipse made out of many sections, such as this:
The goal is to define with variables the outside and inside diameters, and number of segments, and have the program automatically determine the size and arrangement of the segments.
I have been using rmagick to draw a square made of squares in the past, but I have realized that it becomes much more complicated when you need to factor in the inside and outside curves of the segments.
I could see how I could make one image and "copy/paste" it around.
I am hoping there might be another gem/library which I could use for this that would have some built-in circle methods.
It seems like I could draw them using RVG (ruby vector graphics). I could use the polygon method, but that would require calculating the exact x/y coordinates of the points. I could also use a "path": http://www.w3.org/TR/SVG11/paths.html which would allow bezier curves and elliptical arcs
Any of these methods seem like they would involve a lot of calculation.
My idea is to:
- calculate an inside circle, and an outside circle
- use the points on those to get the 4 "corners",
This would still need to account for the curved edges. If I picked values larger than the "corners", then I could draw in an inside and outside circle to trim them down.
However, that seems like it is beating the problem with a stick.
Ideally, I would like to move on to more advanced drawings as well, such as:
Is there any library/gem or even a process which I may be overlooking, that would make this simpler?