Search In
• More options...
Find results that contain...
Find results in...
• 0

# Diagonal linedefs are longer. Is this normal?

## Question

Pretty much as the title says. I'm trying to make a perfect hexagon, but the vertical/lateral lines are shorter than the diagonal ones. I don't really recall this happening before, but it could be that I am excessively doltish today, lol.

The lateral ones are 64 units, the diagonal ones are 91. I'm on GZDoom Builder 2.3.0.2787 and the map format is Doom in Doom format; square size is 32 mp. If this is ordinary behaviour, is there a way around this so that all sides will be even? Thanks in advance.

## Recommended Posts

• 2

Here's some nearly-perfect shapes you can make while still putting vertices on the grid:

Octagons using 3:3 vectors for the diagonals can look a bit off (depending on how big they are) but hexagons drawn using 4:7 vectors are indistinguishable from perfect hexagons to the naked eye.

• 2
1 hour ago, Makazi the Hyena said:

but the vertical/lateral lines are shorter than the diagonal ones.

Congratulations, you've just rediscovered one of the oldest problems of geometry: the square root of two and its irrational nature.

Pythagoras says: the square of the hypotenuse (which here is the diagonal line across a square) is equal to the sum of the square of the two other sides. So if you have a square where the sides are length 1, the square of their sides are worth 1x1 = 1, the sum of the squares of two sides is therefore 1+1=2, so the square of the diagonal is 2. Which means that the length of the diagonal is the square root of 2, or about 1.414. And yes, that means that your diagonal lines are going to be 41.4% longer than the vertical or horizontal ones.

As an aside, it's also why strafe-running is faster.

• 0

1) That's not a hexagon. :p

2) If you want to make a regular octagon, then no, you will not be able to put all the vertices on the grid.

• 0

Gzdoom builder has a function to draw circles. If you give the circle only 8 sides you are drawing an octagon. I don't know if this is going to be a regular octagon, but surely it is a better way to create one.

However, the reason your diagonal linedefs are longer than the others is because they are a diagonal of a square (the grid) that is longer than its side by a factor of √2

• 0

Any particular reason that you *need* to make a perfect hexagon? I'd say that your life will be much easier if you stick mostly to the grid. Players probably won't notice that your diagonals are longer than your verticals and horizontals, and you'll save yourself the headache of being off the grid.

• 0

If you're looking to have perfect texture alignment with a hexagon, that hexagon Grain of Salt posted will work. However, you will need to split those diagonal lines into 2 segments of 64 each (technically 64.5, but it's rounded down). Now, if you want to make an octagon, that second picture will do. But you will need to split the diagonal lines into 8 segments of 8 units long. I made a post about this a while ago.

• 0
1 hour ago, Makazi the Hyena said:

Pretty much as the title says. I'm trying to make a perfect hexagon, but the vertical/lateral lines are shorter than the diagonal ones. [...] The lateral ones are 64 units, the diagonal ones are 91. I'm on GZDoom Builder 2.3.0.2787 and the map format is Doom in Doom format; square size is 32 mp.

Uh... that's not the matter of the editor, I'm afraid it's a matter of basic geometry. ;P

• 0

I'm pretty sure GZDB's eclipse drawing tool has never created even length linedefs. Not sure why, because it doesn't tend to stick to the grid either.

If you want them to be perfectly even, you just have to draw them yourself I'm afraid. If you're in UDMF format you can create "perfect" shapes because you can turn off the grid, but in Doom format it'll always be a little bit off as it has to stick to the grid.

Edit: Can you confirm if you're drawing these yourself or using the ellipse tool? I believe a lot of the replies here presume you're drawing it manually but I suspect you're using the tool.

Edited by Bauul

• 0
1 hour ago, Gez said:

Congratulations, you've just rediscovered one of the oldest problems of geometry: the square root of two and its irrational nature.

Pythagoras says: the square of the hypotenuse (which here is the diagonal line across a square) is equal to the sum of the square of the two other sides. So if you have a square where the sides are length 1, the square of their sides are worth 1x1 = 1, the sum of the squares of two sides is therefore 1+1=2, so the square of the diagonal is 2. Which means that the length of the diagonal is the square root of 2, or about 1.414. And yes, that means that your diagonal lines are going to be 41.4% longer than the vertical or horizontal ones.

As an aside, it's also why strafe-running is faster.

the absolute first thing that came to my mind when why diagonals are longer; they are the hypotenuse of a triangle!!!

• 0
7 hours ago, Gez said:

Congratulations, you've just rediscovered one of the oldest problems of geometry: the square root of two and its irrational nature.

Pythagoras says: the square of the hypotenuse (which here is the diagonal line across a square) is equal to the sum of the square of the two other sides. So if you have a square where the sides are length 1, the square of their sides are worth 1x1 = 1, the sum of the squares of two sides is therefore 1+1=2, so the square of the diagonal is 2. Which means that the length of the diagonal is the square root of 2, or about 1.414. And yes, that means that your diagonal lines are going to be 41.4% longer than the vertical or horizontal ones.

As an aside, it's also why strafe-running is faster.

Ah, I see! Thank you. :)

• 0

A reasonable approximation for an octagon is not too hard.  Set your grid to 32, for example.  Then draw your octagon with 4 grids on the horizontal and vertical sides, and 3 grids on the diagonal sides.  It is not perfect, but it is usually close enough for the player to not notice any imperfection.