For Loop Code Issues, please help adjust code

asked 2014-07-11 07:25:04 -0500

brycemh gravatar image

Below is a copy of my for loop code, it is supposed to draw lines around a circle. The radius is 150. It is supposed to draw a line for every 36th degree and the point I found that goes from the center of the circle to the edge of the circle is (242.7,176.3). The image is 600x600 and the circle's center is (300,300). Below is the code and an image of what happens when i run the code. Please help if you can.

int x = shape->width;
int y = shape->height;
int m = 0;
int l = 2;
int q = 140;
int z = shape->width / l;
int a = shape->height / l;
int b = 10;
int f = -255;
int g = 255;


//Drawing a Circle

// for loop execution 
for(int o = 242.7; o < 450; o+=36){ 
    for(int n = 176.3; n < 450; n+=36){ 
        cvLine(shape, cvPoint(z,a), cvPoint(o,n), CV_RGB(255,0,0),1,8); 

image description

edit retag flag offensive close merge delete