[maths] how would you calculate a diamon size tile
Printed From: Pixel Joint
Category: Pixel Art
Forum Name: WIP (Work In Progress)
Forum Discription: Get crits and comments on your pixel WIPs and other art too!
URL: https://pixeljoint.com/forum/forum_posts.asp?TID=26115
Printed Date: 12 September 2025 at 11:45am
Topic: [maths] how would you calculate a diamon size tile
Posted By: Robbie_Harrison
Subject: [maths] how would you calculate a diamon size tile
Date 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 !
|
Replies:
Posted By: DawnBringer
Date 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
|
Posted By: Robbie_Harrison
Date 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.
|
Posted By: Hapiel
Date 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)
|
Posted By: Axolotl
Date 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.
|
Posted By: eishiya
Date 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.
|
Posted By: DawnBringer
Date 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.
|
Posted By: Robbie_Harrison
Date Posted: 15 January 2018 at 5:45am
@DawnBringer Oh yeah ! It makes sense now ! Thanks a lot !
|
|