Results 1 to 4 of 4

Thread: A script question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default A script question

    Hello Cartographers!
    My question is thus. Is it possible script wise to have pattern fill rotate the pattern tile 90 degrees between each placement of said tile? The reason I ask is I'm using a seamless city tile with my fill and while yes they are seamless once filled there's a repeating 'pattern' to the pattern? I hope that makes sense.

  2. #2

    Default

    Yes, that is definitely possible. However, if you'd like some help beyond general algorithmic guidance, you'll probably need to tell us what your host program is.

    That said, the formulae for 2d rotation are:

    x' = x * cos(Ɵ) - y * sin(Ɵ)
    y' = x * sin(Ɵ) + y * cos(Ɵ)

    That needs to be done on a per-pixel basis. Also, you'll need to correct for the 0 point of your raster. You want to rotate around the center, not 0, which is probably in the lower-left, so multiply x and y by 1/2 of your image's resolution.
    Bryan Ray, visual effects artist
    http://www.bryanray.name

  3. #3
    Software Dev/Rep Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,333
    Blog Entries
    1

    Default

    Your scheme assumes that the pattern tiles seamlessly across edges other than the opposites. Most seamless patterns won't.

    Even if you have a pattern that will still be seamless, you'll still get a repeating pattern doing that, it just won't be quite as obvious.

    Multi-tile seamless patterns work better. There are a few ways of doing this. The simplest is to design several tiles, any one of which will tile seamlessly with any of the others along any edge. Then you can select tiles at random. The downside of this is that all of the tiles have to be similar along the edges which still has the possibility of an obvious repeating pattern, although much reduced for a single tile.

    A more complicated solution is to use "wang tiles". A set of wang tiles assigns a "colour" to each edge of each tile such that you can line them up to cover a plane. This allows the tiles to be similar to each other in different ways. It requires more tiles than the simple multi-tile case and a more complicated algorithm, both for doing the tiling and for making the seamless tiles.

    An even more advanced way to do tiles is to colour the corners rather than the edges. This requires even more tiles than wang tiles, and even more complicated algorithms to work out, but avoids discontinuities between corner adjacent tiles.

    There are a bunch of other variations on this idea such as recursive wang tiles and stochastic wang tiles. https://en.wikipedia.org/wiki/Wang_tile

  4. #4

    Default

    Duh! I completely forgot to talk about the program! I'm using GIMP 2.8. Lovely program

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •