>Hi-
>
>I am implementing opendx for view CFD results. As a first cut I am using
>a simple hexagonal only grid (6 sided cubes,
>8 vertices per hex) with cell-centered data. My question has to do with
>the listing of connections. For each hex, I
>specify the vertices (by number) which enclose the hex. Is there any
>constraint on the order in which I specify the vertices for each hex?
>The user manual says something abouth parity but I'm not sure I
>understand what it is referring to.
>
>TIA,
>-S.
>

To be picky, you describe a hexahedron. A hexagon is a polygon, not a
volume, and unfortunately DX does not support a hexagon. I'm not saying
this to correct you but to head off such a misconception among any newbies
reading the list (I was asked only last week if DX supported hexagons.)


That said, the correct winding of a hex[ahedron] (cube) is described in the
Users Guide, but you can't read the coordinates in the html version: you
need to see the PDF version (linked from the opendx.org site, I think under
Support). When you can see them, you see that conceptually, you list the
vertex indices in the same way as you would list a "C" array, that is,
"lastest is fastest" (Z, Y, X). So a cube with one corner at origin,
extending to +X, +Y, +Z by 1 would be listed:
0,0,0
0,0,1 (Z moves fastest)
0,1,0
0,1,1 (Y next)
1,0,0
1,0,1
1,1,0
1,1,1 (X slowest)

Substitute the index of the vertices in the positions list (which can be in
arbitrary order) in place of the corresponding vectors above and you have
the correct winding.

You don't have to start at the origin (of course, you can't if the
hexahedron isn't at the origin). In fact, as long as you preserve the
winding sense, you can start at any corner. Mentally you can translate and
rotate any cube to match the exemplar just described and preserve the same
winding to ensure outward facing normals on each face.


Here's how I explained it to someone else a couple weeks ago (not on this
list):

 The exemplar cube extends into positive X, Y, and Z (one unit each), as
shown by the positions vectors. In DX, as you face the XY plane, positive Z
comes out toward you, +X to the right, +Y up. In DX, conceptually, the
winding order of such a cube would be shown as position indices that
traverse Z fastest, Y next, X slowest. To denote 3-vector positions, I'm
abbreviating [X,Y,Z] of [0,0,0] as [000]. Thus, in the simplest case, if
the positions were listed as:
([000],[001],[010],[011],[100],[101],[110],[111]), the connection list for
the cube is (0 1 2 3 4 5 6 7), since DX is C-style, with counting starting
at index 0. This order ensures that all face normals will point outward
from the cube faces.

Obviously, if the positions were listed in a different order, the index
list would have to change accordingly to achieve the same winding order.
For example if the list was in order:
([000],[001],[010],[011],[111],[100],[101],[110]), the connection list
would be (0 1 2 3 5 6 7 4).

This is simply for the sake of illustration; if the cube were rotated
arbitrarily in space, the same relative order of vertex listing would
ensure outward facing normals, that is, one does not have to ensure that Z
increases from point 0 to point 1; instead one has only to ensure that one
is crawling over the face of the cube using the same relative order,
regardless of where you start. Here's an example: given the same exemplar
cube, but with positions listed arbitrarily as:
([011],[111],[100],[101],[110],[000],[001],[010]), we decide to call the
position [110] our starting point for the winding walk. The resulting
connection index list is: (4 7 1 0 2 5 3 6).

Chris Pelkie
Vice President/Scientific Visualization Producer
Conceptual Reality Presentations, Inc.
30 West Meadow Drive
Ithaca, NY 14850
[EMAIL PROTECTED]

Reply via email to