Topics

Happy Pi day!!!

Raj Wurttemberg
 

Hey All!

 

Happy Pi Day!  I think that since we are all “grounded”, that it would be a fun challenge for everyone to make a BASIC or ML program to draw a circle on our respective vintage computers.

 

Fun challenge! :)  Post your circle pics!  (Groups.io) can handle pictures.

 

/Raj

 

Brent Carroll
 

Challenge accepted!  I didn't have access to my Ataris, so I did this on an emulator.
--Brent

Raj Wurttemberg
 

Haha!  LOVE it!  Well done! 

 

You should post your code since you did it on the emulator.

 

/Raj

 

From: main@ahcs.groups.io <main@ahcs.groups.io> On Behalf Of Brent Carroll
Sent: Saturday, March 14, 2020 6:31 PM
To: main@ahcs.groups.io
Subject: Re: [ahcs] Happy Pi day!!!

 

Challenge accepted!  I didn't have access to my Ataris, so I did this on an emulator.
--Brent

Josh Litherland
 

Commodore Vic 20 + Super Expander cartridge version.  Can't for the life of me figure out why it divides by zero on the first run every time, but other than that I'm happy with it  :)

10 input "radius (0-512)"; rad
20 input "num points"; dots
30 graphic 2
40 pi=3.14159
50 xctr=512:yctr=512
60 aspect=0.667
70 for theta=0 to 2*pi step 2*pi/dots
80 x=xctr+rad*cos(theta)*aspect
90 y=yctr+rad*sin(theta)
100 point 1,x,y
110 next theta


Josh Litherland
 

Well, I figured out the zero bug at least.  Changing graphics modes wipes out previously set variables.

This program prints 0:

10 x=10

20 graphic 2
30 graphic 4
40 print x

Raj Wurttemberg
 

Happy Pi day from my (real) C64!

 

 

I did do the programming in ‘CBM prg Studio’ on the PC, and the debugging in the VICE emulator at 200% of normal speed.  Plotting the circle on the real C64 was painfully slow. :)

 

/Raj

 

From: main@ahcs.groups.io <main@ahcs.groups.io> On Behalf Of Raj Wurttemberg
Sent: Saturday, March 14, 2020 3:57 PM
To: main@ahcs.groups.io
Subject: [ahcs] Happy Pi day!!!

 

Hey All!

 

Happy Pi Day!  I think that since we are all “grounded”, that it would be a fun challenge for everyone to make a BASIC or ML program to draw a circle on our respective vintage computers.

 

Fun challenge! :)  Post your circle pics!  (Groups.io) can handle pictures.

 

/Raj

 

Jeff Stokes
 

Here’s my attempt from a few years ago to write an efficient circle routine for either Power-C or Super C for the C64 (I forget which one) because there was no included graphics library.

I don’t have a screen shot, but if I remember correctly the subroutine did not draw a perfect circle.

 

 

/* Draw a circle on screen */

void circle(cx, cy, radius)

int cx;

int cy;

int radius;

{

              int x = 0;

              int y = radius;

              int p = (5 - radius * 4) / 4;

 

              /* Initial Plot */

              setPixel(cx, cy + y);

              setPixel(cx, cy - y);

              setPixel(cx + y, cy);

              setPixel(cx - y, cy);

             

              while (x < y)

              {

                             x++;

                            

                             if (p < 0)

                             {

                                           p += 2 * x + 1;

                             }

                             else

                             {

                                           y--;

                                           p += 2 * (x - y) + 1;

                             }

                            

                             /* Plot Points */

                             if (x == y)

                             {

                                           setPixel(cx + x, cy + y);

                                           setPixel(cx - x, cy + y);

                                           setPixel(cx + x, cy - y);

                                           setPixel(cx - x, cy - y);

                             }

                             else if (x < y)

                             {

                                           setPixel(cx + x, cy + y);

                                           setPixel(cx - x, cy + y);

                                           setPixel(cx + x, cy - y);

                                           setPixel(cx - x, cy - y);

                                           setPixel(cx + y, cy + x);

                                           setPixel(cx - y, cy + x);

                                           setPixel(cx + y, cy - x);

                                           setPixel(cx - y, cy - x);

                             }

                            

              } // while()

}

 

Sent from Mail for Windows 10

 

From: Raj Wurttemberg
Sent: Saturday, March 14, 2020 3:57 PM
To: main@ahcs.groups.io
Subject: [ahcs] Happy Pi day!!!

 

Hey All!

 

Happy Pi Day!  I think that since we are all “grounded”, that it would be a fun challenge for everyone to make a BASIC or ML program to draw a circle on our respective vintage computers.

 

Fun challenge! :)  Post your circle pics!  (Groups.io) can handle pictures.

 

/Raj

 

 

Jeff Stokes
 

Oops.. Hasty post. This is not the final version of this function.

The final version is somewhere on one of my many SD-Cards….

I found a collection of links that I was using when attempting to create a graphics library.

Here is where the idea/algorithm came from.

 

http://groups.csail.mit.edu/graphics/classes/6.837/F98/Lecture6/circle.html

 

What I ended up with was similar to the last algorithm shown in the link above.

 

 

Jeff Stokes

 

 

Sent from Mail for Windows 10

 

From: Jeff Stokes
Sent: Sunday, March 15, 2020 10:31 AM
To: main@ahcs.groups.io
Subject: Re: [ahcs] Happy Pi day!!!

 

Here’s my attempt from a few years ago to write an efficient circle routine for either Power-C or Super C for the C64 (I forget which one) because there was no included graphics library.

I don’t have a screen shot, but if I remember correctly the subroutine did not draw a perfect circle.

 

 

/* Draw a circle on screen */

void circle(cx, cy, radius)

int cx;

int cy;

int radius;

{

              int x = 0;

              int y = radius;

              int p = (5 - radius * 4) / 4;

 

              /* Initial Plot */

              setPixel(cx, cy + y);

              setPixel(cx, cy - y);

              setPixel(cx + y, cy);

              setPixel(cx - y, cy);

             

              while (x < y)

              {

                             x++;

                            

                             if (p < 0)

                             {

                                           p += 2 * x + 1;

                             }

                             else

                             {

                                           y--;

                                           p += 2 * (x - y) + 1;

                             }

                            

                             /* Plot Points */

                             if (x == y)

                             {

                                           setPixel(cx + x, cy + y);

                                           setPixel(cx - x, cy + y);

                                           setPixel(cx + x, cy - y);

                                           setPixel(cx - x, cy - y);

                             }

                             else if (x < y)

                             {

                                           setPixel(cx + x, cy + y);

                                           setPixel(cx - x, cy + y);

                                           setPixel(cx + x, cy - y);

                                           setPixel(cx - x, cy - y);

                                           setPixel(cx + y, cy + x);

                                           setPixel(cx - y, cy + x);

                                           setPixel(cx + y, cy - x);

                                           setPixel(cx - y, cy - x);

                             }

                            

              } // while()

}

 

Sent from Mail for Windows 10

 

From: Raj Wurttemberg
Sent: Saturday, March 14, 2020 3:57 PM
To: main@ahcs.groups.io
Subject: [ahcs] Happy Pi day!!!

 

Hey All!

 

Happy Pi Day!  I think that since we are all “grounded”, that it would be a fun challenge for everyone to make a BASIC or ML program to draw a circle on our respective vintage computers.

 

Fun challenge! :)  Post your circle pics!  (Groups.io) can handle pictures.

 

/Raj

 

 

 

Raj Wurttemberg
 

Very cool! Thanks Jeff!

 

Thanks,

/Raj

 

From: main@ahcs.groups.io <main@ahcs.groups.io> On Behalf Of Jeff Stokes
Sent: Sunday, March 15, 2020 11:03 AM
To: main@ahcs.groups.io
Subject: Re: [ahcs] Happy Pi day!!!

 

Oops.. Hasty post. This is not the final version of this function.

The final version is somewhere on one of my many SD-Cards….

I found a collection of links that I was using when attempting to create a graphics library.

Here is where the idea/algorithm came from.

 

http://groups.csail.mit.edu/graphics/classes/6.837/F98/Lecture6/circle.html

 

What I ended up with was similar to the last algorithm shown in the link above.

 

 

Jeff Stokes

 

 

Sent from Mail for Windows 10

 

From: Jeff Stokes
Sent: Sunday, March 15, 2020 10:31 AM
To: main@ahcs.groups.io
Subject: Re: [ahcs] Happy Pi day!!!

 

Here’s my attempt from a few years ago to write an efficient circle routine for either Power-C or Super C for the C64 (I forget which one) because there was no included graphics library.

I don’t have a screen shot, but if I remember correctly the subroutine did not draw a perfect circle.

 

 

/* Draw a circle on screen */

void circle(cx, cy, radius)

int cx;

int cy;

int radius;

{

              int x = 0;

              int y = radius;

              int p = (5 - radius * 4) / 4;

 

              /* Initial Plot */

              setPixel(cx, cy + y);

              setPixel(cx, cy - y);

              setPixel(cx + y, cy);

              setPixel(cx - y, cy);

             

              while (x < y)

              {

                             x++;

                            

                             if (p < 0)

                             {

                                           p += 2 * x + 1;

                             }

                             else

                             {

                                           y--;

                                           p += 2 * (x - y) + 1;

                             }

                            

                             /* Plot Points */

                             if (x == y)

                             {

                                           setPixel(cx + x, cy + y);

                                           setPixel(cx - x, cy + y);

                                           setPixel(cx + x, cy - y);

                                           setPixel(cx - x, cy - y);

                             }

                             else if (x < y)

                             {

                                           setPixel(cx + x, cy + y);

                                           setPixel(cx - x, cy + y);

                                           setPixel(cx + x, cy - y);

                                           setPixel(cx - x, cy - y);

                                           setPixel(cx + y, cy + x);

                                           setPixel(cx - y, cy + x);

                                           setPixel(cx + y, cy - x);

                                           setPixel(cx - y, cy - x);

                             }

                            

              } // while()

}

 

Sent from Mail for Windows 10

 

From: Raj Wurttemberg
Sent: Saturday, March 14, 2020 3:57 PM
To: main@ahcs.groups.io
Subject: [ahcs] Happy Pi day!!!

 

Hey All!

 

Happy Pi Day!  I think that since we are all “grounded”, that it would be a fun challenge for everyone to make a BASIC or ML program to draw a circle on our respective vintage computers.

 

Fun challenge! :)  Post your circle pics!  (Groups.io) can handle pictures.

 

/Raj