Recent

Author Topic: RegEx Patterns: Found Hamming Distance Info on Wolfram  (Read 1692 times)

Boleeman

  • Hero Member
  • *****
  • Posts: 721
RegEx Patterns: Found Hamming Distance Info on Wolfram
« on: September 24, 2024, 07:50:45 pm »
Make some Nice Patterns from Regular Expressions (some are deviated Fractals and some are not).

The patterns seem to be XOR deviations of fractal patterns.
The sizes of the images seem unusually small
(I think the patterns are made of only a few colours but placed in intricate positions)

Got the idea from the attached JavaScript

and here:
https://ssodelta.wordpress.com/2015/01/26/gradient-images-from-regular-expressions/

Would be nice to incorporate the cpp code from here:

https://github.com/ltlollo/misc/blob/master/distrx.cpp

Anyhow. Enjoy my little creation.
« Last Edit: November 30, 2024, 08:34:52 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Nice Patterns From Regular Expressions
« Reply #1 on: September 24, 2024, 10:16:43 pm »
Some more presets
« Last Edit: September 24, 2024, 10:18:47 pm by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Nice Patterns From Regular Expressions
« Reply #2 on: September 25, 2024, 06:25:34 am »
and  ... 104 Presets for 104 Patterns

Download the "testsave4.txt" and copy into the program folder and load it. Then click on a Listbox Row enrty.

Getting Modulo Fractal (in the 1st attached png notice how there is another blue pattern in the background)

Getting 3D Contrasting Type Illusion (2nd attached png)

Getting Colorful XOR Patterns (3rd attached png)

« Last Edit: September 25, 2024, 08:38:12 am by Boleeman »

circular

  • Hero Member
  • *****
  • Posts: 4356
    • Personal webpage
Re: Nice Patterns From Regular Expressions
« Reply #3 on: September 25, 2024, 11:22:19 am »
Now this gives a new dimension to regexes!  :)
Conscience is the debugger of the mind

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Nice Patterns From Regular Expressions
« Reply #4 on: September 26, 2024, 06:25:35 am »
Now ... 238 presets to play around with. (attached below as presets testsave5.txt )

Yes, Circular these patterns seem to be XOR deviations of fractal patterns.

I've seen something like this happen in a Vb6 program that I made that XORs and also in my Blade pattern that I made in Vb6 (in which I mixed XORing with Lines in a Plane). In the vb6 program only red, green or blue was set, whereas in the Lazarus RegX program multiple colors are present.

I have been noticing a few more things with the RegX patterns:

Changing a 1 to a 3 alters the direction of the striped pattern.
(the striped pattern also seems to be formed by splitting colors into wavelengths)
Also the addition of a dot in a certain position after the question mark alters the width of the stripes.
(..*?...)([1.4]+)(..p*) very thin vertical stripes
(..*?..)([14]+)(..p*)  wider vertical stripes
(..*?.)([1.4]+)(..p*)  even wider vertical stripes


To make horizontal stripes:
(..*?...)([3.4]+)(..p*) very thin horizontal stripes
(..*?..)([3.4]+)(..p*)  wider horizontal stripes
(..*?.)([3.4]+)(..p*)  even wider horizontal stripes




Changing the number of dots and their position alters:
The frequency of the pattern
The colour of the pattern
The size of the black squares
The intensity of the color.


Look at the attached png files to see what I mean.


Lastly the sizes of the images seem unusually small (I think the patterns are made of only a few colours but placed in intricate positions)
« Last Edit: September 26, 2024, 07:11:10 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: Nice Patterns From Regular Expressions
« Reply #5 on: October 06, 2024, 05:44:10 am »
151 New Presets.

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: RegEx Patterns: Now Auto Save the Png's
« Reply #6 on: October 19, 2024, 04:54:39 am »
I have found almost 500 new patterns.

Has anyone found any nice patterns?

Attached below are six of my latest favorite patterns:

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: RegEx Patterns: Now Auto Save the Png's
« Reply #7 on: October 19, 2024, 12:35:01 pm »
I like these examples Boleeman.

They remind me of a website that imo has many similarity to your adventures with Lazarus and which was named DelphiForFun (I believe a copy of that website is now listed here).

It had/has many examples of math sometimes stuffed into a graphical representation thereby informing the reader of 2 important things, e.g. how to program something with Delphi and how to understand the math/mechanics behind it and visualize it.

You have now made so many interesting examples that these are imo a worthy competitors/successors to those examples listed at that website.

Keep up the good work and have fun !
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: RegEx Patterns: Now Auto Save the Png's
« Reply #8 on: October 19, 2024, 01:34:13 pm »
@Boleeman! You should get in touch with Transport for London (TFL) because these patterns really remind me of the moquettes used for underground seat cushions ;)

https://www.ltmuseum.co.uk/collections/stories/design/history-moquette
"It builds... ship it!"

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: RegEx Patterns: Now Auto Save the Png's
« Reply #9 on: October 20, 2024, 06:11:13 am »
Thank you TRon and carl_caulkett for your encouraging words and the nice replies. I used to visit Delphi for Fun  quite often (I believe Gary Darby sadly passed away recently), as well as Planet VB. Love all things "Graphics". Thanks Carl for the info on Moquette.

I was going to upload all my saved RegEx Fractal png's to a free download site for people to download freely.



I have been working on trying to convert a C++ RegEx Version to CSharp (mentioned here), as that C++ produces some nice Gradient RegEx patterns but have gotten stumped. I have got it to save to png file but it is not parsing the RegEx string correctly, so I just get a blank black image. I wanted to later on convert the CSharp version to Lazarus.

I wonder if anyone is knowledgeable in CSharp/C++ to get the CSharp version working. There was a reply by someone called nya. Not sure if they are also a member of the Lazarus Forum?

Also Had a go a trying to convert the Java version of "Creating pretty images from regular expressions using edit distance" made by ssodelta with source code here: https://github.com/SSODelta/GradientRegexImages

and tested with these sample RegEx strings:

1*2*0
.?2*1.3
(0+1)*23
3*1?2?0*
1*2?(3+0)+
(12|0*)12*
(0+1)*2?3

It:
Computes the hamming distance between two strings of equal length
Computes the hammer distance between some string k, and the set of matches.
Generates all possible strings of given length using characters '0', '1', '2', '3' for a given string length
The depth = 9  so makes the height and width of the image = 2^9 = 512 pixels.
Matches each of these strings against the regex to produce a gradient fractal.

Not having much luck at present getting an actual gradient fractal pattern being rendered.

I somehow feel the RegEx strings are not being passed properly ? Maybe I am also missing something  else ?

Oh well, I gave it a shot.


« Last Edit: October 20, 2024, 09:34:31 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: RegEx Patterns: New Variation Version
« Reply #10 on: October 30, 2024, 09:54:15 am »
Made a new Variation Version

Now you can:

Alter the depth of recursion (low depth blocky/pixelated curves and high depth has very fine curves)
Set the Back Colour and Curve Colour
Use a Colouring function with varied effects based on colour brightness/darkness
Use any square pixel size canvas


Still would like to try to make that gradient rendered version using hamming distance.
Perhaps one day will work it out.

Meanwhile please enjoy this Variation Version of the RegEx Fractal Renderer.
« Last Edit: October 30, 2024, 11:19:54 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 721
Re: RegEx Patterns: New Variation Version
« Reply #11 on: November 30, 2024, 08:22:37 am »
Came across an example on Hamming Distance rendering on the Wolfram site.
The online example has a slider to adjust the Hamming distance and see what effect it has.

Hamming Distance
https://demonstrations.wolfram.com/DistanceAndDissimilarityPatterns/

Might be useful in trying to work out why the cpp to Lazarus gradient version did not work.

Also came across a Web Archived site on Mathematica Graphic Patterns that had a similar pattern to a RegEx pattern I found in the RegEx Lazarus version I made.
http://web.archive.org/web/20131211045648/http://www.oftenpaper.net/sierpinski.htm

It discussed variations of the Sierpinski triangle. Kinda interesting.

« Last Edit: November 30, 2024, 08:49:43 am by Boleeman »

 

TinyPortal © 2005-2018