[Gmsh] clockwise vs counterclockwise

Bart Vandewoestyne Bart.Vandewoestyne at telenet.be
Mon Mar 14 10:15:12 CET 2011


On Mon, Mar 14, 2011 at 08:41:28AM +0100, Christophe Geuzaine wrote:
> On 07/03/11 16:56, Bart Vandewoestyne wrote:
> >Hello list,
> >
> >I'm working with a 2D geometry and mesh and for my application,
> >all triangles of my mesh should have counterclockwise node
> >ordering.
> >
> >My educated guess was that if the normals to the planes are in
> >the positive Z-direction, then all triangles in that plane will
> >have counterclockwise node ordering.  I therefore created the
> >following .geo file:
> >
> >http://www.kuleuven-kortrijk.be/~bartv/pml_test_1layer.geo
> >
> >Note that on line 28 I wrote
> >
> >   Plane Surface(2) = {1,-2};
> >
> >in order to get the normal vector for that plane right.
> >
> >However, it now appears that all elements (triangles) from that
> >'border layer' have a clockwise ordering instead of
> >counterclockwise, see the resulting .msh file at
> >
> >http://www.kuleuven-kortrijk.be/~bartv/pml_test_1layer.msh
> >
> >(for example element 18 hase nodes 9, 17, 12 which is clockwise).
> >
> >So apparently, the fact that the normal is in the positive
> >direction, doesn't seem to assure me that the node ordering of my
> >elements (triangles) will be counterclockwise???
> >
> >How can I make sure that my elements (triangles) will *always*
> >have a counterclockwise node ordering?  Is it related to the
> >normals of the plane, or is there any other rule to follow?
> 
> Hi Bart - No, your understanding is correct. We have fixed a couple
> of bugs related to surface mesh orientation quite recently. Which
> version of Gmsh do you use?

Christophe,

No problem, I solved my issue.  I had not read carefully enough
the documentation online at

http://www.geuz.org/gmsh/doc/texinfo/gmsh.html#Surfaces

where it is stated:

"[...] The first line loop defines the exterior boundary of the
surface; all other line loops define holes in the surface. [...]"

I had not written the OUTER loop as the first line loop for my
Plane Surface.  Instead, my INNER loop was the first listed.
Switching the order of my inner and outer loop I now have the
statement

Plane Surface(2) = {2,1};

and this seems to give me what I need.

Just for the record: my gmsh version is the one that ships with
Ubuntu 10.10, namely 2.4.2.

Regards,
Bart

-- 
	"Share what you know.  Learn what you don't."