# How can I make this hexagon be exactly the height of the square

I'm trying to make a pattern using this hexagon (the carpet pattern in "the shining") mathematically with nodes. But all my different measurements and equations rely on the hexagon being exactly the height of the square or two units. Just messing around with the less than value It got closer and closer as i approached the value .43333... (6.5/15) but if you look very closely you can see that its a little two big,

so when I tried to recreate the pattern it wasn't perfect.

If there's a way to find the height of the gradient and map it to 1 using map range, or maybe a different way to make a hexagon that defaults to this height, that's what I need.

• By Pythagoras, the height of an equilateral triangle with side 1 is sqrt(3)/2. Split your hex into triangles and juggle.. the width of a hex height 2 is sqrt(3). Check out these ways of making a hex grid..? The first download includes a distance-from-edge function. – Robin Betts Jan 4 at 22:23
• 3**.5/4 is the exact threshold that will match the plane. Dividing the gradient by this number will sort of "normalize" it. – HISEROD Jan 5 at 1:48
• (The actual 2-unit height of your square doesn't make a difference, here.. you're using the Generated texture-space, which will always measure 0-1 along the sides of an object's bounding-box.) – Robin Betts Jan 5 at 10:39

By splitting a hex of height 1 into equilateral triangles, and Pythagoras, we know its side-to-side width is sqrt(3)/2. So, if we just look at the threshold in X, we know that has to be sqrt(3)/4. (And, IMO, that's an easier way to think about it than considering the dot-product branch of your tree)
You would hard-code that value into the Less Than, though, so it doesn't have to be recalculated for every shading-point... (the same goes for your existing sqrt(3). )