Draw an arc from the center of a box outwards


I am trying to draw an arc shape path which starts from the center outwards, but no matter how much I try the arc always begins from (0, 0) point. I tried with “addArc” and “addCentredArc” with different input parameters but it always just starts from (0, 0). I need to show just a portion of a graphic that is inside an arc so I am doing something like this:

  1.   outlineArc.addCentredArc(50, 50, 50, 50, 1, 1.57, 3.14, true);
  2.  outlineArc.addArc(50, 50, 50, 50, 1.57, 3.14, false);
  3.  g.reduceClipRegion(outlineArc);
  4.  g.fillAll(Colours::yellow);

I use line 1 OR 2 not both together, and here for the sake of simplicity I am just filling the Clip region with a colour. I need different angles but in this example it goes from 90 Degree to 180 Degree.
There is a 100*100 square, and I want the arc to start at the center of the box outwards.

Thanks for the helps in advance.


Adding an arc will make it continue from the last point in the path. For a path that begins from the start of the arc, you’d need to startNewSubPath from that point before continuing with the arc itself.


Perfect, that solved the problem. Thanks!