Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Tessellations
#10
So Charlie if one symmetry is good, what's 2 way symmetry look like:
Code: (Select All)
_Title "Tessellation 3 use b to toggle to 1 color and black or full color"
' b+ 2023-05-09 - Tiling with a pattern
' Tessellation 2 will try color filled with more background black.
' Tessellation 3 Charlie mentions a mirror image for interesting tessellating,
' lets try mirroring both x and y axis.
'
' Inspired by Charlie's BAM example:
' https://qb64phoenix.com/forum/showthread.php?tid=1646&pid=15772#pid15772
'
' But I also wanted to try a colorized version.
'
'  So use b key to toggle between:
'  1. a mod of Charlies version with different pixel block size with black backgrounds
'  2. the colorized version which reminds me of Magic Eye Art
'
DefLng A-Z
Screen _NewImage(800, 600, 12) ' only 16 colors here
_ScreenMove 250, 50
Dim Shared Pix '   Pix is number of pixels to Tile side
Dim Shared Scale ' Change a pixel to a bigger square block for not so subtle patterns
Dim Shared Tile '  Handle that stores Tile Image in memory to call up with _PutImage
Dim Shared B '     Set color mode from Full 16 colors Rainbow to 1 like for printing a label
Do
    If InKey$ = "b" Then B = 1 - B '    toggle coloring mode on a b keypress
    MakeTile '                          create a new random tiling pattern
    Tessellate '                        tile the screen with it
    _PrintString (740, 580), "ZZZ..." ' Show user we are sleeping awaiting a key press
    Sleep
Loop Until _KeyDown(27) ' quit when detect escape key on sleep

Sub MakeTile ' make a random tile to Tesselate according to B Mode coloring
    Pix = Int(Rnd * 9) + 4 '           sets tile size: pix X pix or a 4X4 to 12X12 Tile coloring
    Scale = Int(Rnd * 6) + 4 '         to change pixels to square blocks
    If Tile Then _FreeImage Tile '     throw old image away
    Tile = _NewImage(2 * Scale * Pix - 1, 2 * Scale * Pix - 1) '   make new one
    _Dest Tile '                       draw in the memory area Tile not on screen
    oneColor = Int(Rnd * 15) + 1 '     one color and black background for B Mode
    For y = 0 To Scale * Pix Step Scale
        For x = 0 To Scale * Pix Step Scale
            If B Then
                If Rnd < .5 Then c = 0 Else c = oneColor 'one color and black background for B Mode
            Else
                c = Int(Rnd * 16)
            End If
            Line (x, y)-Step(Scale, Scale), c, BF ' this should be integer since Tile is
            Line (2 * Scale * Pix - x - 1, y)-Step(Scale, Scale), c, BF
            Line (x, 2 * Scale * Pix - y - 1)-Step(Scale, Scale), c, BF
            Line (2 * Scale * Pix - x - 1, 2 * Scale * Pix - y - 1)-Step(Scale, Scale), c, BF
        Next
    Next
    _Dest 0
End Sub

Sub Tessellate ' just covering the screen with our Tile
    For y = 0 To _Height Step 2 * Scale * Pix
        For x = 0 To _Width Step 2 * Scale * Pix
            _PutImage (x, y)-Step(2 * Scale * Pix, 2 * Scale * Pix), Tile, 0
        Next
    Next
End Sub

Full color is back with all 16 available for being employed:
   

Toggle to 1 color and black:
   

Gotta say, so far I think I am progressing Smile  after edit, I see something wrong in symmetry of crosses, dang!
EDIT #2: OK now I think I got perfect symmetry, updated code and snaps.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
Random Tessellations - by bplus - 05-09-2023, 02:29 PM
RE: Random Tessellations - by James D Jarvis - 05-09-2023, 07:37 PM
RE: Random Tessellations - by mnrvovrfc - 05-09-2023, 07:55 PM
RE: Random Tessellations - by bplus - 05-09-2023, 08:00 PM
RE: Random Tessellations - by James D Jarvis - 05-09-2023, 10:30 PM
RE: Random Tessellations - by mnrvovrfc - 05-09-2023, 08:14 PM
RE: Random Tessellations - by bplus - 05-09-2023, 09:11 PM
RE: Random Tessellations - by vince - 05-09-2023, 09:40 PM
RE: Random Tessellations - by bplus - 05-09-2023, 09:45 PM
RE: Random Tessellations - by bplus - 05-10-2023, 12:12 AM
RE: Random Tessellations - by CharlieJV - 05-10-2023, 12:41 AM
RE: Random Tessellations - by mnrvovrfc - 05-15-2023, 10:46 PM
RE: Random Tessellations - by bplus - 05-16-2023, 12:55 AM
RE: Random Tessellations - by bplus - 05-19-2023, 12:14 PM
RE: Random Tessellations - by bplus - 06-04-2023, 09:14 PM
RE: Random Tessellations - by grymmjack - 06-05-2023, 12:29 AM
RE: Random Tessellations - by Kernelpanic - 06-05-2023, 02:35 PM
RE: Random Tessellations - by bplus - 06-05-2023, 04:15 PM
RE: Random Tessellations - by bplus - 06-05-2023, 04:42 PM
RE: Random Tessellations - by Kernelpanic - 06-05-2023, 05:35 PM
RE: Random Tessellations - by bplus - 06-05-2023, 05:37 PM
RE: Random Tessellations - by Kernelpanic - 06-05-2023, 05:45 PM
RE: Random Tessellations - by bplus - 06-05-2023, 05:50 PM
RE: Random Tessellations - by bplus - 06-05-2023, 06:06 PM
RE: Random Tessellations - by Kernelpanic - 06-05-2023, 06:17 PM
RE: Random Tessellations - by bplus - 06-05-2023, 06:24 PM
RE: Random Tessellations - by bplus - 06-05-2023, 06:17 PM
RE: Random Tessellations - by Kernelpanic - 06-05-2023, 06:27 PM
RE: Random Tessellations - by Kernelpanic - 06-05-2023, 06:37 PM
RE: Random Tessellations - by bplus - 06-05-2023, 06:43 PM
RE: Random Tessellations - by Kernelpanic - 06-05-2023, 07:37 PM
RE: Random Tessellations - by bplus - 06-05-2023, 07:49 PM
RE: Random Tessellations - by bplus - 06-05-2023, 08:04 PM
RE: Random Tessellations - by Kernelpanic - 06-05-2023, 09:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Springs2 (random graphic art) mstasak 4 544 11-13-2025, 12:44 PM
Last Post: Dav
  Unique Random Array Program eoredson 5 844 07-10-2025, 10:29 AM
Last Post: DANILIN
  Getting a random number wihout RND. Dav 25 7,490 06-03-2025, 08:35 PM
Last Post: madscijr
  Random Object Wandering TerryRitchie 1 744 09-29-2024, 03:38 PM
Last Post: TerryRitchie
  Funny Random Sentence Generator SierraKen 5 3,535 09-12-2024, 05:57 PM
Last Post: DANILIN

Forum Jump:


Users browsing this thread: 1 Guest(s)