Author Topic: anglestring()  (Read 233 times)

0 Members and 1 Guest are viewing this topic.

ABer

  • Administrator
  • Hero Member
  • *****
  • Posts: 781
    • View Profile
anglestring()
« on: November 26, 2022, 07:53:04 AM »
Hi Jean - I'm struggling with the anglestring() function. This test code shows the problem. You can also see in the graphics. The string for the Moon's position, when at the 'noon' position, does not appear alongside the other positions. It seems that the radius element of the function might have a bug when planets are in this angular position. It might be me alternatively, but I can't see where the code is wrong.

anglestring

Syntax anglestring(int mx, int my, int angle, int radius, char string[$]);

Action: displays the string 'string' from middle mx, my at angle 'angle' and radius 'radius'.

-----------------------------------------------------------------------------------------------------------------------

window(0, 0);
menu(0, "Close", close);

real testAngle[9] = { 25, 270, 275, 265, 48, 110, 199, 230, 18};
int indexAngle[9], i, x, y;
char s[99];

@go;
run;

:go;
  visible(0);
  fill(0, 0, width, height, -2);
 
  sortplanets(testAngle, indexAngle, 4, 0);
 
  i = 0; for (i < 9){
 
    putplanet(450, 500 + i * 20, i);
    putrealnumber(500, 500 + i * 20, testAngle, 4);
    putnumber(600, 500 + i * 20, indexAngle);
   
    getcirclepos(width * .725 - width * .0025, height * .5 - width * .0025, height * .39, 180 - indexAngle, x, y);
    putplanet(x, y, i);
   
    ` angle
    strset(s, "%2a", testAngle);
   
    ` pushes string out of window
    ` anglestring(width * .725, height * .5, 180 - indexAngle, height * .45, s);}
   
    ` brings string into window
    anglestring(width * .725, height * .5, 180 - indexAngle, height * .35, s);}
   
   
  visible(1);
  return;

:close;
  quit;


Jean

  • Administrator
  • Hero Member
  • *****
  • Posts: 822
    • View Profile
Re: anglestring()
« Reply #1 on: November 26, 2022, 08:15:14 AM »
Tough one Ed, I can see it messes up, i 'm gonna play with it later today.
Greetings from Groningen Netherlands <)))><.`.><(((>

ABer

  • Administrator
  • Hero Member
  • *****
  • Posts: 781
    • View Profile
Re: anglestring()
« Reply #2 on: November 26, 2022, 08:36:24 AM »
Thanks Jean - much appreciated. There's no rush, it's just an odd one. Ed

Jean

  • Administrator
  • Hero Member
  • *****
  • Posts: 822
    • View Profile
Re: anglestring()
« Reply #3 on: November 26, 2022, 12:27:48 PM »
It's somewhat better but not perfect, try it out..
Greetings from Groningen Netherlands <)))><.`.><(((>

ABer

  • Administrator
  • Hero Member
  • *****
  • Posts: 781
    • View Profile
Re: anglestring()
« Reply #4 on: November 26, 2022, 12:39:43 PM »
Thanks ever so much Jean - all good. It seems fine to me on the anglestring.ab code above.

Will continue to test but it looks like you've solved the issue.

What was the resolution?

Ed

Jean

  • Administrator
  • Hero Member
  • *****
  • Posts: 822
    • View Profile
Re: anglestring()
« Reply #5 on: November 26, 2022, 12:51:12 PM »
I just tried out things for an hour or so and it turned out i couldn't do very much, only a slight code change.
Greetings from Groningen Netherlands <)))><.`.><(((>

ABer

  • Administrator
  • Hero Member
  • *****
  • Posts: 781
    • View Profile
Re: anglestring()
« Reply #6 on: November 26, 2022, 12:53:37 PM »
It's worked anyway!

 :)