Create an equilateral triangle mesh

Viewed 612

I am looking for a numerically stable way to create an equilateral triangle mesh.

My current approach is to generate the x coordinates of the vertices as i * 1/stepsize for even rows and stepsize/2 + i * 1/stepsize for odd rows. For the y coordinate I use j * stepsize * sqrt(3.0/4.0), where sqrt(3.0/4.0) is the height of an equilaterial triangle with edge length 1.

Then I connect the grid vertices accordingly and the result looks nice:

An equilateral triangle mesh

But when I calculate the edge lengths and sort them, I see that two edges of almost the same length have a difference of about the double floating point epsilon and the error amplifies in the application where I would like to use the mesh.

Is there a way to create such a grid with exact edge lengths? Using the irrational square root probably introduces numeric instabilities, but I am not sure if it can be avoided.

0 Answers
Related