Pastebin
Paste #1122: No description
< previous paste - next paste>
Pasted by canon
void *canon(void *args)
{
struct canon_arg *arguments;
arguments = (struct canon_arg *) args;
int **image;
image = arguments->image;
int **energy;
energy = arguments->energy;
int pcnt = arguments->pcnt;
int id = arguments->id;
printf("Thread with id %d starting\n",id);
/*
printf("pcnt:%d\n",pcnt);
printf("x:%f\n",arguments->pos.a);
printf("y:%f\n",arguments->pos.b);
printf("ax:%f\n",arguments->angle.a);
printf("ay:%f\n",arguments->angle.b);
*/
int i;
for(i = 0; i < pcnt+1; i++)
{
//double x = pos.a;
double x = arguments->pos.a;
//double y = pos.b;
double y = arguments->pos.b;
//double ax = angle.a;
double ax = arguments->angle.a;
//double ay = angle.b;
double ay = arguments->angle.b;
double sx = normal_variate(.0,0.15);
double sy = normal_variate(.0,0.15);
double dx = ax+sx;
double dy = ay+sy;
int done = 0;
while(x>=0 && y >= 0 && x < xsize && y < ysize && !done)
{
int density = (int)(randint(11)*(256-image[(int)x][(int)y]));
if(density > 1700)
{
int ix = (int)x;
int iy = (int)y;
energy[ix][iy]=energy[ix][iy]+1;
done = 1;
}
x=x+dx;
y=y+dy;
}
}
printf("Thread with id %d finishing\n",id);
return NULL;
}
New Paste
Go to most recent paste.