Menu

draw arcs with glcd

2020-09-18
2020-09-25
  • stan cartwright

    stan cartwright - 2020-09-18

    This is a simple way of plotting part radius of a circle from start degree to end degree
    values 0 to 359
    xcentre of arc
    ycentre of arc
    xradius-distance from xcentre to xradius
    yradius-distance from ycentre to yradius

    #INCLUDE <TRIG2PLACES.H>
    dim xcentre,ycentre,xradius,yradius,degrees,start_arc,end_arc as word
    xcentre=120:ycentre=180:xradius=130:yradius=130:start_arc=0:end_arc=359
    arc
    end
    
    sub arc
    for degrees=start_arc to end_arc
      pset (xcentre+xradius*sin(degrees)/255,ycentre+yradius*cos(degrees)/255,ILI9341_YELLOW)
    next
    end sub
    

    This code would plot a circle mid screen fast'
    change xradius=100:yradius=140 and you get an eliptical circle.
    change start_arc to 90 and end_arc to 270 and you get half the eliptical circle.
    you can have any part of a circle or elipse positioned anywhere by changing the variables.
    make those boxes curved corners or design guages.
    I'll post a video later.
    It is simple code but does what glcd can not as a command.

    for count =0 to 359
    xradius=count/2:yradius=count/2:start_arc=count:end_arc=count+1
    arc
    next
    

    drew the image almost instant.The code is worth playing with if you are into gcb graphics and gcb trig works fast it seems.
    expanding circle with wait 5 s to see it's a spiral not circles, https://www.youtube.com/watch?v=luowdg_HUUE

     

    Last edit: stan cartwright 2020-09-19
  • stan cartwright

    stan cartwright - 2020-09-25

    No comments. gcb users only use 2 line displays.
    gcb is fast enough to do nice graphics... but not a popular thing.
    uno has
    Flash 32k bytes (of which .5k is used for the bootloader)
    SRAM 2k bytes
    EEPROM 1k byte
    that's plenty to play with.
    a lot can be done without resorting to nextion...which can be made to look good but is serial 9600.
    glcd and spi or parallel 8 bit port are so much faster. just needs a bit of imagination.
    a bit of trig to design a screen would be used once but the gcb trig runs fast. dunno how much mem it uses but it's handy...if you remember learning trig.
    no PI though.

    edit trig was something I was taught but never found an application for
    until graphics... on a cpc464 in z80 asm...and now 328p using basic,,sigh

     

    Last edit: stan cartwright 2020-09-25
  • stan cartwright

    stan cartwright - 2020-09-25

    imho the hardware includes have been the best gcb improvements...but I use a 328
    so the pic stuff improvements don't mean so much,
    using glcd would be so difficult otherwise....memories of implementing
    draw line on a picaxe with ssd 1306...interesting I suppose, if you have the time...
    and the time it took to draw the line using picaxe.
    Thanks to the authors of gcb includes.

    drawing shapes like half circle could be filled using trig but adapting the glcd filled circle
    might be better. dunno how to fill polygons.

     
  • stan cartwright

    stan cartwright - 2020-09-25

    imho the hardware includes have been the best gcb improvements...but I use a 328
    so the pic stuff improvements don't mean so much,
    using glcd would be so difficult otherwise....memories of implementing
    draw line on a picaxe with ssd 1306...interesting I suppose, if you have the time...
    and the time it took to draw the line using picaxe.
    Thanks to the authors of gcb includes.

    drawing shapes like half circle could be filled using trig but adapting the glcd filled circle
    might be better. dunno how to fill polygons. mid point something.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.