WIP (Work In Progress)
 Pixel Joint Forum : Pixel Art : WIP (Work In Progress)
Message Icon Topic: [maths] how would you calculate a diamon size tile Post Reply Post New Topic
Author Message
Robbie_Harrison
Seaman
Seaman


Joined: 26 October 2017
Online Status: Offline
Posts: 3
Quote Robbie_Harrison Replybullet Topic: [maths] how would you calculate a diamon size tile
    Posted: 14 January 2018 at 4:08am
Hello everyone,

I've come to you for a particular problem I thought I'd never face ever again : Maths !

I was working on some tiles for the game of a friend, and was doing a cell-like pavement that I particularely liked :



once put together, it would make a cool pavement, perfect to make round surface and so on :



the problem being : I don't really know how to make a tile out of it. Out of luck, the first dimension I tried was perfectly the right size, once put into a 32*32 or 16*16 tiles, it fit perfectly, meaning that I could allign the tile without the cell being "cut" :



but obviously, when I tried bigger or smaller cell, it's impossible to make them into 32*32 tiles. So I came here to call for your help : does anyone have any idea how to calculate the dimension of a diamond-shape cell so that it's possible to make it into a 32*32 tile ? Because i've been racking my brain without figuring it out. Thank you !
IP IP Logged
DawnBringer
Commander
Commander
Avatar

Joined: 22 December 2017
Online Status: Offline
Posts: 508
Quote DawnBringer Replybullet Posted: 14 January 2018 at 7:19am
Quick look, don't sue me if I'm wrong! :D

Appears to be a diagonal tiling of square sub-tiles with overlap. So THIS specific pattern must meet the condition t*(p-o) = s
Where t = subtiles, p = subtile size, o = overlap & s = tile size.

So in your case 4*(5-1) = 16 works (as does 8*(5-1) = 32)

16 and 32 only has 2 as primefactors and can only be divided by 2 or n^2. Which means both subtiles and (subtile size - overlap) must be divisible by n^2.

Which means the only 1 pixel overlap possibilities are
2 * (17-1) = 32
4 * (9-1) = 32
8 * (5-1) = 32
IP IP Logged
Robbie_Harrison
Seaman
Seaman


Joined: 26 October 2017
Online Status: Offline
Posts: 3
Quote Robbie_Harrison Replybullet Posted: 14 January 2018 at 8:18am
Hey ! Thanks for the awnser ! Unfortunately I don't think it's right, unless I misunderstood your equations :p.

I tried with a 9 pixel side diamond, but it does not do the trick :/ I feel like 5 pixel large is the only way ; here is two 32*32 tiles put side to side with diamond with 9 pixels large size.

IP IP Logged
Hapiel
Rear Admiral
Rear Admiral
Avatar

Joined: 11 November 2017
Online Status: Offline
Posts: 2937
Quote Hapiel Replybullet Posted: 14 January 2018 at 8:39am
I thought this was going to be simple, but I guess not :/

DB, I followed your rule here, right? The tile in my example has a width of (9-1) and a height of (8), so it's square and should fit in a 16x16 tile...
Yet I found this shape by randomly playing around, which only fits in a 33x66 tile... :o



(edit: posted before seeing reply above)
IP IP Logged
Axolotl
Midshipman
Midshipman
Avatar

Joined: 20 May 2016
Online Status: Offline
Posts: 56
Quote Axolotl Replybullet Posted: 14 January 2018 at 9:18am
It's called tessellation.
The shape's not a diamond at all, have to count every corner (20 by my count)
The overlap causes additional problems I think.  The math's never gonna be simple.
IP IP Logged
eishiya
Commander
Commander
Avatar

Joined: 10 August 2015
Online Status: Offline
Posts: 957
Quote eishiya Replybullet Posted: 14 January 2018 at 9:20am
I suspect we've all misunderstood what DB meant by "overlap". I'm not going to guess.


All this is is a brick pattern turned 45 degrees. So, if one diagonal is split into an even number of rows (just as you'd divide a regular brick pattern into an even number of rows along the vertical), and the other diagonal is split into some number of brick "widths" (just as you'd have an integer number of bricks along the horizontal in a regular brick pattern), you'll have a working pattern. That the bricks intersect with a sawtooth pattern is merely cosmetic and doesn't impact the math at all.
In other words, I recommend approaching this from the tile down to the cell, rather than from the cell up to the tile.

For example:

On the left, I made four rows and plopped a "vertical" cell boundary every 4 pixels along the other diagonal (4 divides nicely into 32). Since everything divides nicely, it tiles seamlessly. On the right, I just added the sawtooth pattern.
IP IP Logged
DawnBringer
Commander
Commander
Avatar

Joined: 22 December 2017
Online Status: Offline
Posts: 508
Quote DawnBringer Replybullet Posted: 14 January 2018 at 9:48am
The formula was about strictly diagonally tiled squares (which the original pattern can be viewed as).

What I forgot to account for is the spacing which is a function of the overlap (and subtile size).

Yellow area is overlap.

IP IP Logged
Robbie_Harrison
Seaman
Seaman


Joined: 26 October 2017
Online Status: Offline
Posts: 3
Quote Robbie_Harrison Replybullet Posted: 15 January 2018 at 5:45am
@DawnBringer Oh yeah ! It makes sense now ! Thanks a lot !
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum