Liberty BASIC Community Forum
« [RC] Archimedean Spirals »

Welcome Guest. Please Login or Register.
Jan 22nd, 2018, 6:01pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: [RC] Archimedean Spirals  (Read 244 times)
tenochtitlanuk
Moderator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1179
xx [RC] Archimedean Spirals
« Thread started on: Jan 30th, 2017, 11:25am »

Rosetta Code
Quote:
The Archimedean spiral is a spiral named after the Greek mathematician Archimedes. It can be described by the equation:
r = a + b *theta with real numbers a and b.
Task- Draw an Archimedean spiral.


One of those easy low-hanging-fruit tasks no-one has filled in for LB! So how about this throbbing picture for up-coming Valentine's Day??...

Code:
    WindowWidth  =510
    WindowHeight =530

    nomainwin

    a =40
    b = 4

    open "Archimedean Spiral" for graphics_nsb as #wg

    #wg "trapclose [quit]"

    for theta =0 to 100 step 0.1
        r   =a +b *theta
        if r >240 then exit for
        xS  =int( 250 +r *cos( theta))
        yS  =int( 250 -r *sin( theta))
        #wg "goto "; xS; " "; yS
        #wg "down"
    next theta

    wait

    [quit]
    close #wg
    end
 


As always I get carried away with LB's easy GUI interface, and the following resulted ten minutes later...
User Image
EDIT I'm getting sucked in.....
User Image
« Last Edit: Jan 30th, 2017, 1:04pm by tenochtitlanuk » User IP Logged

tsh73
Moderator
ImageImageImageImageImage


member is offline

Avatar

Anatoly (real name)


PM

Gender: Male
Posts: 1732
xx Re: [RC] Archimedean Spirals
« Reply #1 on: Jan 30th, 2017, 2:54pm »

Reading about Valentine's Day,
I thought you made something like this:
Code:
WindowWidth  =510
    WindowHeight =530

    nomainwin

    a =0
    b = 40
    pi = acs(-1)

    open "Archimedean Spiral" for graphics_nsb as #wg

    #wg "trapclose [quit]"
    #wg "down"

    #wg "set 250 250"
    for theta =0 to 6/4*pi step 0.1
        r   =a +b *theta
        if r >240 then exit for
        xS  =int( 250 +r *cos( theta))
        yS  =int( 250 -r *sin( theta))
        #wg "goto "; xS; " "; yS
    next theta
    #wg "set 250 250"
    for theta =0 to 6/4*pi step 0.1
        r   =a +b *theta
        if r >240 then exit for
        xS  =int( 250 -r *cos( theta))
        yS  =int( 250 -r *sin( theta))
        #wg "goto "; xS; " "; yS
    next theta

    wait

    [quit]
    close #wg
    end
 

:)
User IP Logged

damned Dog in the Manger
tsh73
Moderator
ImageImageImageImageImage


member is offline

Avatar

Anatoly (real name)


PM

Gender: Male
Posts: 1732
xx Re: [RC] Archimedean Spirals
« Reply #2 on: Jan 30th, 2017, 2:58pm »

Quote:
EDIT I'm getting sucked in.....

coding for fun is indeed contagious B)
Code:
WindowWidth  =510
    WindowHeight =530

    nomainwin

    a =0
    b = 40
    pi = acs(-1)

    open "Archimedean Spiral" for graphics_nsb as #wg

    #wg "trapclose [quit]"
    #wg "down"

    #wg "set 250 250"
    #wg "color red"
    for theta =0 to 6/4*pi step 0.01
        r   =a +b *theta
        if r >240 then exit for
        xS  =int( 250 +r *cos( theta))
        yS  =int( 250 -r *sin( theta))
        #wg "set 250 250"
        #wg "goto "; xS; " "; yS
    next theta
    #wg "set 250 250"
    for theta =0 to 6/4*pi step 0.01
        r   =a +b *theta
        if r >240 then exit for
        xS  =int( 250 -r *cos( theta))
        yS  =int( 250 -r *sin( theta))
        #wg "set 250 250"
        #wg "goto "; xS; " "; yS
    next theta

    wait

    [quit]
    close #wg
    end
 
User IP Logged

damned Dog in the Manger
tenochtitlanuk
Moderator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1179
xx Re: [RC] Archimedean Spirals
« Reply #3 on: Jan 30th, 2017, 3:58pm »

Nice ones too, Anatoly!
A quick Valentine response- dedicated to my wife of so many years! ( Uses the 'filled vector shapes' I put up recently...

User Image

I suppose I ought to program the heart shapes to follow your heart path!
User IP Logged

tenochtitlanuk
Moderator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1179
xx Re: [RC] Archimedean Spirals
« Reply #4 on: Jan 30th, 2017, 6:49pm »

Yup!
User Image
User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5618
xx Re: [RC] Archimedean Spirals
« Reply #5 on: Jan 31st, 2017, 02:52am »

Fun stuff indeed, this just happens to use a spiral, before any one worries about me being lonely, I'm not its just the lyrics of the song smiley

Valentine
User IP Logged

tenochtitlanuk
Moderator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1179
xx Re: [RC] Archimedean Spirals
« Reply #6 on: Jan 31st, 2017, 08:53am »

'Heartfelt' thanks for the image, Rod!
User Image

Those who can see these stereograms should see it in depth with two 'J's for myself and my wife!
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls