I have a custom Dougnut chart drawer, which can draw doughnuts like this:
I'm pretty satisfied with this, however I'd like to finetune it and I just have no idea of the right solution.
I'd like to have parallel gaps (paddings) between slices.
I raised those paddings to have better view of my goal.
This is how I'm drawing this currently:
double cx, cy; //center points of circle
double r1, r2; //radius of outer and inner circle
double pad = M_PI / 360 * 12; //12 degree pad
double alpha = -1 * M_PI / 2; //starting from up (noon)
double da = 0.0; // delta of current slice
for (ALL_SLICES) {
calculate_da(&da); //calculate slice's delta
// drawing
move_pen(cx + r2 * cos(alpha + pad/2), cy + r2 * sin(alpha + pad/2)); //STEP1
draw_arc(cx, cy, r1, alpha + pad/2, alpha + da - pad/2); //STEP2
draw_negative_arc(cx, cy, r2, alpha + da - pad/2, alpha + pad/2); //STEP3
fill();
//update next alpha
alpha += da;
}
Drawing steps:
So this is fairly simple, however to have parallel gaps between slices, I'd have to calculate another angle for the outer end and start points:
I've drawn quite a lot of triangles already but I was not able to solve this easily.
Again: the goal is to have parallel paddings between the slices, i.e. bringing these 2 red dots closer together on the circumference, to get exact parallel lines between two slices.
Update:
This is how it looks with scaled padding from @chux answer:
Unfortunately it's not perfect, these lines are not parallel:







