View Full Version : Hexagon mesh

FurnaceMan

02-21-2003, 04:38 AM

I'm trying to create a mesh of hexagons with w hexagons wide x h hexagons high x l hexagons long. The hexagons must be all adjacent. This seems like a basic application, but I see no examples anywhere. I could use the basic glDraw commands, but I have a problem with duplicate overlaying faces.

Does anyone have a solution to this?

I see GL has some map and mesh commands for complex surfaces. Is this a better way to do this?

shinpaughp

02-21-2003, 08:46 AM

If you are trying to create a 3D grid of hexagons such that all edges line up with edges of other hexagons it is geometrically impossible. Hexagons line up perfectly in 2D space as do squares. In 3D space, only cubes (square faces) will line up perfectly, assuming you are looking for 3D objects where faces are of same size and shape.

If I am incorrect in my assumption of what you are trying to do, give more detail. If you have a sample of what you are trying to do, along with a screenshot of your results that could be helpful also.

FurnaceMan

02-21-2003, 10:32 AM

The dimensions of each hexagon (width, height, length) do not have to be the same; therefore, they are hexagons and not cubes, and will most definitely be adjacent in 3d space. Of course, the width, height, length must be the same for each hexagon. The overall result will be a large hexagon, with its width, height, and length a multiple of the individual element hexagons.

I am doing a basic finite element application, if that helps.

I want to be able to user-enter the number of elements in each direction, so the model size can be changed

I have tried using quads and quad strips with vertix arrays, but setting up the vertix array indicies is a killer. It's hard to come up with an algorithm that can calc the indicies.

There must be an easier way to do this, but this is my first openGL app.......

shinpaughp

02-21-2003, 12:14 PM

For finite element applications, it is always best to use triangles, IMHO. Every book I have on FEA and FEM uses triangles, but that was mainly for mechanical property analysis (tension, compression, shear, etc). Maybe your needs are for other purpose.

So, these hexagons all lie within a plane? You aren't trying to create a polyhedron with hexagonal faces, and each polyhedron fits nicely with each other in all directions? That is what I was thinking when I read your original post.

As for quads/triangles... It takes 6 triangles to make a hexagon and only 3 quads to make a hexagon. But, with GL_QUAD_STRIP there will always be at least 1 repeated vertex. If you want to make each hexagon in one pass with minimal, non-repeated vertices, use GL_TRIANGLE_FAN or GL_POLYGON.

Anyway, I still don't know exactly what you are looking for, so I'll leave you to it.

1) The OP is using the term "hexagon" to mean a 3D brick element, while many think it as a 2d, 6 edged polygon. If you think of a hexagon as a 6 sided element in 3D it is OK.

2) It is not always best to use triangles, it depends on the problem. Most FEA and FEM books use triangles for the simple reason that they are the easiest 2D finite element.

To the OP.

Hex meshing is not a trivial problem and is not in the scope of OpenGL, i.e. you won't find any OpenGL help for a finite element data structure that you need to define depending on your intent. Also realize that 3D modellers for visualization that are the norm, are only interested in surface meshing, where as FEA requires the interior mesh also. Quad strips are not very useful for interior meshes because it is impossible to wind the surfaces of a brick in a single strip. OpenGL is an excellent and widely used renderer for FEA mesh visualization. If you are simply meshing a box you should be able come up with something and you will have to set up the vertix arrays yourself. If you want to mesh a general shape use google to look up info. Sandia National Labratories developed a hex meshing algorithm that you might be able to get your hands on.

shinpaughp

02-23-2003, 11:10 AM

A hexagon is a 2D element. A hexahedron is a 3D element. So, hexagon in this case is a misnomer. It does make sense now what he was asking. Everytime I read it I kept thinking he was attempting to construct a decatetrahedron (or is it tetradecahedron???) with hexagonal faces. But, JP, thank you for the clarification.

FurnaceMan, I can give you a simple solution if it is just a matter of duplicate faces. Either email me, or post back.

FurnaceMan

02-25-2003, 05:10 AM

Thanks all for your help. I will check the Sandia site.

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.