[Gmsh] clockwise vs counterclockwise

Christophe Geuzaine cgeuzaine at ulg.ac.be
Mon Mar 14 08:41:28 CET 2011


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?


> Regards,
> Bart
>


-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine