Thread: Patterns to produce "meaningful" patterns

  1. #1
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528

    Patterns to produce "meaningful" patterns

    I've been playing around with libpng for a while now.

    I've mainly be working around the file format, headers, compression, interlacing and what have you. Well as I hack around this, I just generate some random image data which may not be very appealing

    Now, coming to the question, are there some patterns I could use/implement code for to produce some at least "appealing" images
    Last edited by Aslaville; 03-12-2015 at 05:16 AM.

  2. #2
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Fractals

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    There's some discussion on map-generation techniques here -> Map generator in C (text mode)
    Maybe this will inspire something.

  4. #4
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    I used this to create a sin wave:

    Code:
    for (i = 0; i < pointsSize; i++ ) {
        points[i].y = sin(i * 3.1415926 / 180) * (bufferHeight / 4);
        points[i].x = i;
    }
    In my program I used a timer to draw one line past the current line end each time the timer signaled. Then when I reached the end, I would clear the buffer and start again. This produced the effect of a sine wave drawn across the screen. Currently the amplitude of the wave should be half the buffer size. You might need to update the points[i].x value to take into account the width of the buffer though (I just changed the extents of the screen).

    Don't know if this is something like what you wanted though? Good luck in any case!
    WndProc = (2[b] || !(2[b])) ? SufferNobly : TakeArms;

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Settings the color/brightness of a pixel based on the XOR of its X and Y coordinates produces a pleasing self-similar pattern.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  6. #6
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    Quote Originally Posted by brewbuck View Post
    Settings the color/brightness of a pixel based on the XOR of its X and Y coordinates produces a pleasing self-similar pattern.
    Got this :

    Patterns to produce &quot;meaningful&quot; patterns-firstimage-jpg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-08-2014, 08:12 PM
  2. Patterns and anti-patterns
    By Neo1 in forum C++ Programming
    Replies: 3
    Last Post: 10-23-2013, 05:30 PM
  3. Replies: 2
    Last Post: 01-13-2010, 04:58 PM
  4. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  5. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM