iscw

| main | Tutorials | Functions | website |

Checks if the elements of the mesh are in clockwise orientation. Although Matlab has a similar built in function ispolycw this function is vectorized for 2D meshes

Version : 1.0

Author : George Kourakos

email: giorgk@gmail.com

web : http://groundwater.ucdavis.edu/msim

Date 18-Mar-2014

Department of Land Air and Water

University of California Davis

Contents

Usage

tf = iscw(p, MSH)

Input p : Mesh node coordinates [ np x 2] MSH : Mesh [Nel x Nsh]

Output

tf*: true if the polygon orientation is clockwise

Example

Create a hypothetical mesh

p = 10*rand(10,2);
MSH = delaunay(p(:,1), p(:,2));

Check the all element mesh orientation without looping through each element

tf=iscw(p,MSH)
tf =

     0
     0
     0
     0
     0
     0
     0
     0
     0
     0

Lets reverse the orientation

MSH = [MSH(:,1) MSH(:,3) MSH(:,2)];
tf=iscw(p,MSH)
tf =

     1
     1
     1
     1
     1
     1
     1
     1
     1
     1

| main | Tutorials | Functions | website |