Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Makazi the Hyena

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.

 

H9QtpOz.png

 

 

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.

Share this post


Link to post

11 answers to this question

Recommended Posts

  • 2

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

 

hexgrid.png.36a6012ca92e3c27571ab01ed3042cb8.png1465537924_gridoct.png.3bc3d11863da79d5b5656517ab444835.png

 

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.

Share this post


Link to post
  • 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.

Share this post


Link to post
  • 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.

Share this post


Link to post
  • 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

Share this post


Link to post
  • 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.

Share this post


Link to post
  • 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.

Share this post


Link to post
  • 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

Share this post


Link to post
  • 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

Share this post


Link to post
  • 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!!!

Share this post


Link to post
  • 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. :)

Share this post


Link to post
  • 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.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×