I am using that but I only get some strange words :(
I get my coordinates from x and y array..... what is the problem???

for(a=1;a<i;a++){
yyy=(y[a-1]- y[a]);
xxx=(x[a-1]- x[a]);
slope[a-1]=yyy/xxx;}
yyy=(y[i-1]- y[0]);
xxx=(x[i-1]- x[0]);
slope[i-1]=yyy/xxx;
for(b=1;b<i;b++){
yyy=(slope[b-1]+slope[b]);
xxx=(1-slope[b-1]*slope[b]);
angle=yyy/xxx;
res=acos(angle) * (180/3.14);
printf("%d. Angle %f\n",b,res);}
yyy=(slope[i-1]+slope[0]);
xxx=(1-slope[i-1]*slope[0]);
lastangle=yyy/xxx;
res=acos(lastangle) * (180/3.14);
printf("%d. Angle %f\n",b,res);
for(a=1;a<i;a++)
{
  yyy = (y[a-1]- y[a]);
  xxx = (x[a-1]- x[a]);
  slope[a-1]=yyy/xxx;
}

yyy = (y[i-1]- y[0]);
xxx = (x[i-1]- x[0]);
slope[i-1]=yyy/xxx;

for(b=1;b<i;b++)
{
  yyy = (slope[b-1]+slope[b]);
  xxx = (1-slope[b-1]*slope[b]);
  angle = yyy/xxx;
  res = acos(angle) * (180/3.14);

  printf("%d. Angle %f\n",b,res);
}

yyy = (slope[i-1]+slope[0]);
xxx = (1-slope[i-1]*slope[0]);
lastangle = yyy/xxx;
res = acos(lastangle) * (180/3.14);

printf("%d. Angle %f\n",b,res);

yeah now i can read it.

ok, i am not 100% sure on what you are trying to do but I think you might want to add the second set to the first loop and the 4th set to the second loop. Or you might want to have 4 sets of loops there. I am not sure, but you are looping through the elements of a, but you are only doing the i element once... seems odd. but again I am not sure what you are trying to so. i see slope.... slope is math.

Choosing some more meaningful variable names rather than xxx yyy zzz etc would probably tell you a lot.

xxx / yyy is pretty meaningless, but if you had something like apples / oranges, it becomes pretty darn obvious very quickly that it is a completely stupid thing to even try.

This article has been dead for over six months. Start a new discussion instead.