Concentric Circles

Hello all,

I am trying to draw 5 concentric circles using polylines. The following code builds properly but seems to crash once I run. Any ideas on why?

#define NUM_CIRCLES 5
ofPolyline circle[NUM_CIRCLES];
int innerCircleSize = 100;
int circleRes = 30;

void testApp::setup(){

//draw circles
for(int i=0; i < NUM_CIRCLES; i++){
    innerCircleSize = innerCircleSize + 30;
    circle[i].arc(ofGetWidth()/2, ofGetHeight()/2, innerCircleSize, innerCircleSize, 0, 360, circleRes);
void testApp::draw(){


Just a guess, is your circle index out of bounds in the draw method?

NUM_CIRCLES=5, so the range should be 0 to 4. So maybe you should do:



Actually, you need to loop through all 5 instances of circle in your draw method too, not just the one index.

1 Like

YES! Thank you very much Gwydion.

To fix, In draw();

for(int i=0; i < NUM_CIRCLES; i++){