Rounded corners on pie segments


Hi there,

I am implementing a matrix of cells arranged in a polar fashion.
Cells are therefore indexed by rings and slices not by columns and rows, which would happen in a regular cartesian matrix.

Basically, that’s how I draw the path to generate each cell:

for (i = 0; i < slices; ++i) {
    for (j = 0; j < rings; ++j) {
        addCentredArc(centerX, centerY, radius, radius, 0.0, angleStart, angleEnd, TRUE);
        addCentredArc(centerX, centerY, radius, radius, 0.0, angleEnd, angleStart, FALSE);

        radius -= radiusDelta;
    angleStart += angleDelta;
    angleEnd += angleDelta;


Now, I would like to give the user the ability to round the corners of each cell.
To do that I use:

if (cornerRadius > 0.0) {

What I would like to get is something like this for ALL cell sizes:

The problem I am experiencing is that very often for certain cell sizes not all corners are rounded equally:

When this happens - as you can see from the picture - only 2 of the 4 corners are not rendered correctly.
Could it be that there is a better way to specify/build my path, so that the renderer can deal with creating rounded corners correctly ?

Any thoughts ?

Thank you.

  • Luigi


Could be a rounding error at smaller sizes, I guess… If you can give me a block of code I can paste straight into the juce demo to show this happening, I could have a quick trace through and see if I can spot anything going wrong…