Squares

General FreeBASIC programming questions.
albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 21, 2019 17:35

Here's Abstract_0039.bas

Code: Select all


dim as single c1 , c2 , c3
dim as single s1 , s2 , s3

dim as single x1 , x2 , x3
dim as single y1 , y2 , y3

dim as single deg1 , deg2 , deg3

dim as single rad1
dim as single rad2


dim as integer xctr , yctr , radius , divisions , fullcircle

dim as integer xres , yres
'screen 19
screeninfo xres , yres
screenres xres , yres , 8 , 1 , 8

xctr = ( xres / 2 ) '- 150
yctr = ( yres / 2 ) ' - 100

radius = ( xres * yres ) / ( (xres + yres ) * 4 )
radius = 100

divisions = 45

rad1 = atn( 1 ) / divisions
rad2 = atn( 1 ) / ( divisions / 2 )
fullcircle = ( atn( 1 ) * 8 / rad1 )

do
   
        for deg1 = 0 to fullcircle step 1
   
            c1 = cos( deg1 * rad1 )
            s1 = sin( deg1 * rad1 )
   
            x1 = radius * c1 * sqr( sqr( deg1 ) ) / 4
            y1 = radius * s1 * sqr( sqr( deg1 ) ) / 4
           
            for deg2 = 0 to fullcircle / 2 step 10
           
                c2 = cos( deg2 * rad2 )
                s2 = sin( deg2 * rad2 )
           
                x2 = radius * c2 * atn( deg1 * c1 )
                y2 = radius * s2 * atn( deg2 * s1 )
               
                for deg3 = 0 to fullcircle / 4 step .5
               
                    c3 = cos( deg2 * rad2 )
                    s3 = sin( deg2 * rad2  )
               
                    x3 = radius * c3 * tan( c2 / c1 ) / 10
                    y3 = radius * s3 * tan( s2 / s1 ) / 10
                   
                    pset( xctr +x1+x2+x3 , yctr +y1+y2+y3),9
                    pset( xctr -x1-x2-x3    , yctr +y1+y2+y3),9
                    pset( xctr +x1+x2+x3 , yctr -y1-y2-y3),9
                    pset( xctr -x1-x2-x3    , yctr -y1-y2-y3),9
           
            next
           
        next
   
    next

loop until inkey <>""

albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 21, 2019 19:03

Here's Abstract_0040.bas

Looks , so so .. not real great.

Code: Select all


dim as single c1 , c2
dim as single s1 , s2
dim as single x1 , x2
dim as single y1 , y2
dim as single deg1 , deg2
dim as single rad1
dim as single rad2


dim as integer xctr, yctr, radius, divisions, fullcircle, toggle

dim as integer xres , yres
'screen 19
screeninfo xres , yres
screenres xres , yres , 8 , 1 , 8

xctr = ( xres / 2 ) '- 150
yctr = ( yres / 2 ) ' - 100

radius = ( xres * yres ) / ( (xres + yres ) * 4 )
radius = 100

divisions = 45

rad1 = atn( 1 ) / divisions
rad2 = atn( 1 ) / ( divisions / 2 )
fullcircle = ( atn( 1 ) * 8 / rad1 ) / 11.25

do
   
        for deg1 = 0 to fullcircle step .01
   
            c1=cos( deg1 * rad1 * 45 )
            s1=sin( deg1 * rad1 * 45 )
   
            x1=radius * c1 * tan( c1 ) * atn( c1 ) * tan( c1 * s1 ) / 4
            y1=radius * s1 * tan( s1 ) * atn( s1 ) * tan( c1 * s1 )
           
        for deg2 = 0 to fullcircle / 4 step .1
           
            c2=cos( deg2 * rad2 * 90 )
            s2=sin( deg2 * rad2 * 90 )
       
            x2=radius * c2 * atan2( s1 * c1 , s1 / c1 ) * log( c1 * s2 * 2 ^ 4 ) / 2
            y2=radius * s2 * atan2( c1 * s1 , c1 / s1 )
           
            pset(xctr+x1+x2,yctr+y1+y2),9
            pset(xctr-x1-x2,yctr+y1+y2),9
           
            pset(xctr+x1+x2,yctr-y1-y2),9
            pset(xctr-x1-x2,yctr-y1-y2),9
           
        next
   
    next

loop until inkey <>""



=====================================================
@Dodicat

I got another compression formula done...
I won;t post it till i get the de-compressor working.

I'll figure it out on my own , i won't ask for help...
albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 21, 2019 22:42

Here's Abstract_0041.bas

Code: Select all


dim as single c1 , c2
dim as single s1 , s2
dim as single x1 , x2
dim as single y1 , y2
dim as single deg1 , deg2
dim as single rad1
dim as single rad2


dim as integer xctr, yctr, radius, divisions, fullcircle, toggle

dim as integer xres , yres
'screen 19
screeninfo xres , yres
screenres xres , yres , 8 , 1 , 8

xctr = ( xres / 2 ) '- 150
yctr = ( yres / 2 ) ' - 100

radius = ( xres * yres ) / ( (xres + yres ) * 4 )
radius = 100

divisions = 45

rad1 = atn( 1 ) / divisions
rad2 = atn( 1 ) / ( divisions / 2 )
fullcircle = ( atn( 1 ) * 8 / rad1 ) / 11.25

do
   
        for deg1 = 0 to fullcircle step .01
   
            c1 = cos( deg1 * rad1 * 45 )
            s1 = sin( deg1 * rad1 * 45 )
   
            x1 = radius * c1 * tan( c1 ) * atn( c1 ) * tan( c1 * s1 ) / 4
            y1 = radius * s1 * tan( s1 ) * atn( s1 ) * tan( c1 * s1 ) / 1
           
        for deg2 = 0 to fullcircle / 4 step .1
           
            c2 = cos( deg2 * rad2 * 90 )
            s2 = sin( deg2 * rad2 * 90 )
       
            x2 = radius * c2 * atan2( x1 / c2 , deg2 * s1 / c1 )
            y2 = radius * s2 * atan2( y1 / s2 , deg2 * c1 / s1 )
           
            pset(xctr+x1+x2,yctr+y1+y2),9
            pset(xctr-x1-x2,yctr+y1+y2),9
            'pset(xctr+x1+x2,yctr-y1-y2),9
            'pset(xctr-x1-x2,yctr-y1-y2),9
           
        next
   
    next

loop until inkey <>""

albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 21, 2019 22:47

Here's Abstract_0042.bas

Code: Select all


dim as single c1 , c2
dim as single s1 , s2
dim as single x1 , x2
dim as single y1 , y2
dim as single deg1 , deg2
dim as single rad1
dim as single rad2


dim as integer xctr, yctr, radius, divisions, fullcircle, toggle

dim as integer xres , yres
'screen 19
screeninfo xres , yres
screenres xres , yres , 8 , 1 , 8

xctr = ( xres / 2 ) '- 150
yctr = ( yres / 2 ) ' - 100

radius = ( xres * yres ) / ( (xres + yres ) * 4 )
radius = 100

divisions = 45

rad1 = atn( 1 ) / divisions
rad2 = atn( 1 ) / ( divisions / 2 )
fullcircle = ( atn( 1 ) * 8 / rad1 ) / 11.25

do
   
        for deg1 = 0 to fullcircle step .01
   
            c1 = cos( deg1 * rad1 * 45 )
            s1 = sin( deg1 * rad1 * 45 )
   
            x1 = radius * c1 * tan( c1 ) * atn( c1 ) * tan( c1 * s1 ) / 4
            y1 = radius * s1 * tan( s1 ) * atn( s1 ) * tan( c1 * s1 ) / 1
           
        for deg2 = 0 to fullcircle / 4 step .1
           
            c2 = cos( deg2 * rad2 * 180 )
            s2 = sin( deg2 * rad2 * 180 )
       
            x2 = radius * c2 * atan2( x1 / c2 , deg2 * s1 / c1 )
            y2 = radius * s2 * atan2( y1 / s2 , deg2 * c1 / s1 )
           
            pset(xctr+x1+x2,yctr+y1+y2),9
            pset(xctr-x1-x2,yctr+y1+y2),9
            'pset(xctr+x1+x2,yctr-y1-y2),9
            'pset(xctr-x1-x2,yctr-y1-y2),9
           
        next
   
    next

loop until inkey <>""

albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 21, 2019 23:19

Here's Abstract_0043.bas

Code: Select all


dim as single c1 , c2
dim as single s1 , s2

dim as single x1 , x2
dim as single y1 , y2

dim as single deg1 , deg2
dim as single rad1 , rad2

dim as integer xctr , yctr , radius , divisions , fullcircle

dim as integer xres , yres
'screen 19
screeninfo xres , yres
screenres xres , yres , 8 , 1 , 8

xctr = xres / 2
yctr = yres / 2

radius = ( xres * yres ) / ( (xres + yres ) * 4 )

divisions = 45

rad1 = atn ( 1 ) / divisions
rad2 = atn( 1 ) / ( divisions / 2 )
fullcircle = atn( 1 ) * 8 / rad1

radius = 200

do
   
        for deg1 = 0 to fullcircle step 1
   
            c1 = cos( deg1 * rad1 )
            s1 = sin( deg1 * rad1 )
   
            x1 = radius * c1 * tan( deg1 / 360 )
            y1 = radius * s1 * tan( deg1 / 360 )
   
        for deg2 = 0 to fullcircle * 2 step 5
           
            c2 = cos( deg2 * rad2 )
            s2 = sin( deg2 * rad2 )
       
            x2 = radius * s2 * tan( deg2 / 360 )
            y2 = radius * c2 * tan( deg2 / 360 )
             
            pset( xctr +x1 +x2 , yctr +y1 +y2 ) , 9
            pset( xctr +x1 +x2 , yctr -y1 -y2 ) , 9
           
            pset( xctr -x1 -x2 , yctr +y1 +y2 ) , 9
            pset( xctr -x1 -x2 , yctr -y1 -y2 ) , 9
       
        next
   
    next

loop until inkey <>""

albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 21, 2019 23:24

Here's Abstract_0044.bas

Code: Select all


dim as single c1 , c2
dim as single s1 , s2

dim as single x1 , x2
dim as single y1 , y2

dim as single deg1 , deg2
dim as single rad1 , rad2

dim as integer xctr , yctr , radius , divisions , fullcircle

dim as integer xres , yres
'screen 19
screeninfo xres , yres
screenres xres , yres , 8 , 1 , 8

xctr = xres / 2
yctr = yres / 2

radius = ( xres * yres ) / ( (xres + yres ) * 4 )

divisions = 45

rad1 = atn ( 1 ) / divisions
rad2 = atn( 1 ) / ( divisions / 2 )
fullcircle = atn( 1 ) * 8 / rad1

radius = 50

do
   
        for deg1 = 0 to fullcircle step 1
   
            c1 = cos( deg1 * rad1 )
            s1 = sin( deg1 * rad1 )
   
            x1 = radius * c1 * tan( deg1 / 360 ) * atn( c1 )
            y1 = radius * s1 * tan( deg1 / 360 ) * atn( s1 )
   
        for deg2 = 0 to fullcircle * 2 step 5
           
            c2 = cos( deg2 * rad2 )
            s2 = sin( deg2 * rad2 )
       
            x2 = radius * s2 * tan( deg2 / 360 ) * log( deg2 * c2 )
            y2 = radius * c2 * tan( deg2 / 360 ) * log( deg2 * s2 )
             
            pset( xctr +x1 +x2 , yctr +y1 +y2 ) , 9
            pset( xctr +x1 +x2 , yctr -y1 -y2 ) , 9
           
            pset( xctr -x1 -x2 , yctr +y1 +y2 ) , 9
            pset( xctr -x1 -x2 , yctr -y1 -y2 ) , 9
       
        next
   
    next

loop until inkey <>""

albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 22, 2019 0:19

Here's Abstract_0045.bas

Code: Select all


dim as single c1 , c2
dim as single s1 , s2

dim as single x1 , x2
dim as single y1 , y2

dim as single deg1 , deg2

dim as single rad1
dim as single rad2


dim as integer xctr , yctr , radius , divisions , fullcircle

dim as integer xres , yres
'screen 19
screeninfo xres , yres
screenres xres , yres , 8 , 1 , 8

xctr = xres / 2
yctr = yres / 2

radius = ( xres * yres ) / ( (xres + yres ) * 4 )
radius = 200

divisions = 45

rad1 = atn( 1 ) / divisions
rad2 = atn( 1 ) / ( divisions / 2 )
fullcircle = atn( 1 ) * 8 / rad1

do
   
        for deg1 = 0 to fullcircle step .1
   
            c1=cos( deg1 * rad1 )
            s1=sin( deg1 * rad1 )
   
            x1=radius * c1 * atan2( deg1 ,  deg2 )
            y1=radius * s1 * atan2( deg1 ,  deg2 )
           
        for deg2 = 0 to fullcircle step 10
           
            c2=cos( deg2 * rad2 )
            s2=sin( deg2 * rad2 )
       
            x2=radius * c2 * atan2( y1 , x2 ) * atn( c2 * s2 )
            y2=radius * s2 * atan2( x1 , y2 ) * atn( s2 * c2 )
             
            pset( xctr +x1 +x2 , yctr +y1 +y2 ) , 9
            pset( xctr +x1 +x2 , yctr -y1 -y2 ) , 9
           
            pset( xctr -x1 -x2 , yctr +y1 +y2 ) , 9
            pset( xctr -x1 -x2 , yctr -y1 -y2 ) , 9
           
        next
   
    next

loop until inkey <>""

albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 22, 2019 0:21

I went back a couple pages , and changed the "topic" of the first posted doodle to , "Trigonometry Doodles"

So later on , i can find the doodles , by searching for "Trigonometry Doodles"
albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 22, 2019 0:23

I'll only save and post , the doodles that i think are cool...
So my hard drive doesn't get full of bad doodles.

That way ; i know all the doodles are cool looking...
albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 22, 2019 0:55

I bundled and sent all my doodles to DARPA
I thought the govt. might like them...

I heard , they use trig doodles , to encrypt data..
dodicat
Posts: 5991
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Postby dodicat » Oct 22, 2019 21:16

They are certainly all different, coming from the same kind of template.
#44 is quite nice.
I'll look up some of my old ones, most stuff needs updated slightly now for the current compiler.
I have a bad filing system, they are all over the place.
albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 22, 2019 23:09

@Dodicat

My favorite , so far , is Abstract_0022.bas

I thought of naming them , so i can remember them easier
But i had troubles thinking up names for each doodle. So i stuck with numbers.

After i compiled and sent the 45 doodles to DARPA.
I heard voices in the wind , saying , they fed all the formulas into the AI engine , and it started making all kinds of cool doodles , like fireworks.
I also heard voices saying , "bring all the doodles up on the screen , at the same time.".

Have you heard of the Linux saying ; "Read the source and use the force" ? I use the force to write the doodles.

It's amazing , you can take one doodle and change the stepping , or change one var ,and it creates a whole different doodle.
You can make dozens of doodles from one set of formulas..

So far , it just all been experimental , i just type in sin cos tan atn atan2 and keep altering and adding functions to it , till it looks cool.

=====================================================================================

I'm going to go , one step at a time , and try each function with vars. to see how it makes the doodle change..
Then i can get an understanding of what to add to get different effects.

====================================================================================
albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 22, 2019 23:29

@Dodicat

I came up with another compression technique.. ( compresses 1+K per loop )

I wonder if it can be undone ??

for a as longint = 1 to len( chrs ) step 1

n1 = chrs[ a - 1 ] mod 16 ' equls 0 to 15
n2 = chrs[ a - 1 ] \ 32 ' equals 0 to 7

outs1+= right( "0000" + bin( n1 ) , 4 )
outs2+= right( "000" + bin( n2 ) , 3 )
next

If the mod is half the division it compresses...

Can it be undone???
albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 23, 2019 0:16

Here's Abstract_0046.bas

Kinda simpleton..

Code: Select all


dim as single c1 , c2
dim as single s1 , s2

dim as single x1 , x2
dim as single y1 , y2

dim as single deg1 , deg2

dim as single rad1
dim as single rad2


dim as integer xctr , yctr , radius , divisions , fullcircle

dim as integer xres , yres
'screen 19
screeninfo xres , yres
screenres xres , yres , 8 , 1 , 8

xctr = xres / 2
yctr = yres / 2

radius = ( xres * yres ) / ( (xres + yres ) * 4 )
radius = 100

divisions = 45

rad1 = atn( 1 ) / divisions
rad2 = atn( 1 ) / ( divisions / 2 )
fullcircle = atn( 1 ) * 8 / rad1

do
   
        for deg1 = 0 to fullcircle step 1
   
            c1=cos( deg1 * rad1 )
            s1=sin( deg1 * rad1 )
   
            x1=radius * c1
            y1=radius * s1
           
        for deg2 = 0 to fullcircle step 1
           
            c2=cos( deg2 * rad2 )
            s2=sin( deg2 * rad2 )
       
            x2=radius * c2 * atan2( c2 , c1 / s1 )
            y2=radius * s2 * atan2( s2 , s1 / c1 )
             
            pset( xctr +x1 +x2 , yctr +y1 +y2 ) , 9
            pset( xctr +x1 +x2 , yctr -y1 -y2 ) , 9
           
            pset( xctr -x1 -x2 , yctr +y1 +y2 ) , 9
            pset( xctr -x1 -x2 , yctr -y1 -y2 ) , 9
           
        next
   
    next

loop until inkey <>""

albert
Posts: 5248
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Oct 23, 2019 0:25

Here's Abstract_0047.bas

Code: Select all


dim as single c1 , c2
dim as single s1 , s2

dim as single x1 , x2
dim as single y1 , y2

dim as single deg1 , deg2

dim as single rad1
dim as single rad2


dim as integer xctr , yctr , radius , divisions , fullcircle

dim as integer xres , yres
'screen 19
screeninfo xres , yres
screenres xres , yres , 8 , 1 , 8

xctr = xres / 2
yctr = yres / 2

radius = ( xres * yres ) / ( (xres + yres ) * 4 )
radius = 200

divisions = 45

rad1 = atn( 1 ) / divisions
rad2 = atn( 1 ) / ( divisions / 2 )
fullcircle = atn( 1 ) * 8 / rad1

do
   
        for deg1 = 0 to fullcircle step 20
   
            c1=cos( deg1 * rad1 )
            s1=sin( deg1 * rad1 )
   
            x1=radius * c1 * sqr( sqr( deg1 * rad1 ) )
            y1=radius * s1 * sqr( sqr( deg1 * rad1 ) )
           
        for deg2 = 0 to fullcircle step .1
           
            c2=cos( deg2 * rad2 )
            s2=sin( deg2 * rad2 )
       
            x2=radius * c2 * atan2( c2 , c1 / s1 ) * sqr( log( deg2 / rad1 * c1 * s1 ) ) / 4
            y2=radius * s2 * log( deg2 / rad1 * c1 * s1 ) / 8 * tan( s1 ) / 2
             
            pset( xctr +x1 +x2 , yctr +y1 +y2 ) , 9
            pset( xctr +x1 +x2 , yctr -y1 -y2 ) , 9
           
            pset( xctr -x1 -x2 , yctr +y1 +y2 ) , 9
            pset( xctr -x1 -x2 , yctr -y1 -y2 ) , 9
           
        next
   
    next

loop until inkey <>""


Return to “General”

Who is online

Users browsing this forum: albert and 2 guests