Example

Circle drawing algorithm?

5

412lop 2022-10-07 01:41

This will produce good circles but you can’t position the circle

Circle.nx | Open in app
2022-10-07 01:41

SP4CEBAR 2022-10-07 09:44 (Edited)

Here's how you can position the circle

SUB CIRCLE(XPOS,YPOS,WIDTH,HEIGHT,COLR)
  FOR TY = 0 TO 15
    FOR TX = 0  TO 19
      SWP = SWP + 0.1
      CELL XPOS+((SIN(SWP)+1))*(WIDTH/2),YPOS+((COS(SWP)+1))*(HEIGHT/2),COLR
    NEXT TX
  NEXT TY
END SUB

also, it seems like the TX and TY variables aren't being used, so it could be simplified to this:

SUB CIRCLE(XPOS,YPOS,WIDTH,HEIGHT,COLR)
  FOR SWP = 0 TO 2*PI STEP 0.1
    CELL XPOS+(SIN(SWP)+1)*0.5*WIDTH,YPOS+(COS(SWP)+1)*0.5*HEIGHT,COLR
  NEXT SWP
END SUB


Log in to reply.