np = 20;
points = rand(np, 2);
tri = delaunay(points(:,1), points(:,2));
ntri = size(tri, 1);
p1 = [points(tri(:,1), :), zeros(ntri, 1)];
p2 = [points(tri(:,2), :), zeros(ntri, 1)];
p3 = [points(tri(:,3), :), zeros(ntri, 1)];
cr = cross(p2-p1, p3-p1);
fprintf(1, 'clockwise: %d\n', length(find(cr(:,3) > 0)));
fprintf(1, 'counter clockwise: %d\n', length(find(cr(:,3) < 0)));
