Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Myself and a few others a while back were looking for a method or equation to draw a grid on an EE world, and have it fit perfectly (i.e no cut off cells.)
This equation, when true, should indicate whether or not the grid that you are choosing to use will perfectly fit on your world. Let me know if there's any errors, as I didn't check it tonnes.
Let (in terms of full blocks):
m = world width
n = world height
p = grid width
q = grid height
This will assume that your world has a one block border around the entire world. The grid will have a border of one block (i.e the minimum amount of blocks for a grid to appear.)
is defined where
Everything after this equation is only useful if you want to customize the equation, or want different border sizes.
or in general for the y-direction:
where,
r1 = top border
r2 = bottom border
u = grid border (bottom)
in general for the x-direction:
where,
t1 = left border
t2 = right border,
s = grid border (right)
and,
Therefore, the following equation can be derived, for any p x q grid on m x n world with r, s, t, u borders it will fit perfectly if:
Note: canvas size of n and m do include borders into their calculation: take the size of the canvas including all of the borders. Also, if u and s are 0, the equation will still be defined but having no grid borders doesn't make much sense (unless you have a specific purpose for that.)
The result from each sub-expression (divided by the + sign) is the block overflow in each direction respectively. From there, you can increase or decrease the canvas size by the result of that expression to accommodate your grid.
The following equation shows how many blocks it will take to draw the grid:
where the variables follow the same restrictions as previously mentioned.
If the grid overflows from the canvas, then, well, things get a bit complicated. You can use the following to calculate a grid that doesn't overflow too, but it's a bit wasteful. You can use this equation to calculate how many blocks it would take to draw that monster:
(I didn't fully check this yet!)
If you want to resize the grid, and have every grid item the same size after the resize, then you must resize in factors of:
(for the x direction, where x > p, x > 2, and x in N)
(for the y direction, where y > q, y > 2, and y in N)
For example, if you wanted to resize a canvas of 20 blocks horizontally and the p-sized cell 6 units, it would have to be (20-2)/(6+1) = 18/6 = a factor of 3 units. So, you could resize it by 3 units, 6, 9, 12...
First attempt at mathematically proving this (might be completely wrong; take it with a grain of salt):
Offline
(m - 1) mod p + (n - 1) mod q = 0
Unfortunately I wasn't able to arrive at that simplification of the formula, or correction. I'm not super good with math, so perhaps my reasoning is wrong.
Would you be able to show step-by-step how you arrived at that?
Offline
Sorry I'm on drugs(literally).
Lets say we have a world with the width of n and with the height of m.
EE worlds have borders: top, left, bottom and right.
The top and bottom borders are made of n blocks
The left and right boarders are made of m blocks
To determine the remaining blocks we must subtract the borders:
so n * m - 2n - 2m - 4(the junctions) = (n - 2) (m - 2)
p is the width of the desired grid and q is the height of it
p and q must divide n respectively m perfectly.
so (n - 2) mod p + (m - 2) mod q = 0
Everybody edits, but some edit more than others
Offline
Sorry I'm on drugs(literally).
Lets say we have a world with the width of n and with the height of m.
EE worlds have borders: top, left, bottom and right.
The top and bottom borders are made of n blocks
The left and right boarders are made of m blocksTo determine the remaining blocks we must subtract the borders:
so n * m - 2n - 2m - 4(the junctions) = (n - 2) (m - 2)p is the width of the desired grid and q is the height of it
p and q must divide n respectively m perfectly.
so (n - 2) mod p + (m - 2) mod q = 0
Ah I see now. I think we're doing two slightly different operations (one where the border block is inside of the p-sized cell, and the latter where it is not contained within):
- Mine considers [X][ ][ ][ ][X][ ][ ][ ][X][ ][ ][ ][X] valid because for n = 13 and p = 3, (n-1) mod (p+1) is equal to (13-1) mod (3+1) = 12 mod 4 = 0
- Yours considers [X][ ][ ][ ][X][ ][ ][ ][X][ ][ ][ ][X][X] valid because for n = 14 and p = 3, (n-2) mod p is equal to (14-2) mod 3 is 12 mod 3 = 0 which mine does not consider; the graph is fully contained within the canvas, and the last block which would have been cut off isn't because it is now part of the border.
However, both equations would consider [X][ ][ ][X][ ][ ][X][ ][ ][X] valid, where p = 2 and n = 10 which...
Offline
For stairs,
where m = length of canvas, p = length of step, r = amount of blocks each step is overlapping the previous. If this equation is true, there will be no overlapping in the x-axis. You can use a negative value for r, if needed.
where q = height of step, n = height of canvas. If this equation is true, there will be no overlapping in the y-axis.
If you want to calculate the area of hollow steps (i.e steps with nothing underneath them) use p * q * n, where p = length of step, n = height of canvas, q = blocks in between each step (normally one.)
If you want to calculate the area of steps with blocks underneath them (i.e filling all empty space) then use:
where the variables are the same, and s = i (in this case i is not an imaginary number.) If you don't like sums, you can use instead (kudos to Wolfram|Alpha for converting the sum into a summation formula.)
Offline
What is this
Uh, something is going wrong with this:
I didn't even do anything...
thanks zoey aaaaaaaaaaaand thanks latif for the avatar
Offline
Uh, something is going wrong with this:
http://i.imgur.com/ZmX0p6f.pngI didn't even do anything...
Oh shoot, I didn't check the transparency with the default Coal theme. I'll have to make those on a white background soon--a workaround in the meantime is to use the snow theme. Thanks for noticing that!
What is this
These equations help world creators make stairs and grids, by using mathematical patterns to determine if they will fit in your world, based on the requirements that you have. It reduces trial and error to just an equation being non-zero, rather than having to draw the entire grid every time in your world, which can be frustrating. Moreover, it can allow bots to draw grids/stairs that fit perfectly inside of a certain shape, allowing dynamic multiplayer maps.
If you need (or anyone) needs any help using the equations, or wants to know how I arrived at the solution, let me know as I didn't include any diagrams yet and so my language is a bit vague as to what the variables represent. The validity of the equations isn't guaranteed, but I'll be working with them in other cases to see if they fail.
Offline
These equations help world creators make stairs
no please
Offline
Umm. What is this even about like. Ok.
Offline
Umm. What is this even about like. Ok.
If you want to make a grid, or a whole bunch of minigame containers, and don't want any that are chopped off, just plug in the parameters into the equation and if it equals 0, it'll fit perfectly.
Offline
[ Started around 1732074667.0442 - Generated in 0.074 seconds, 13 queries executed - Memory usage: 1.61 MiB (Peak: 1.79 MiB) ]