private static boolean isClockWise( Grid g ) {
		EllipseRotated_F64 v00 = g.get(0,0);
		EllipseRotated_F64 v02 = g.columns<3?g.get(1,1):g.get(0,2);
		EllipseRotated_F64 v20 = g.rows<3?g.get(1,1):g.get(2,0);

		double a_x = v02.center.x - v00.center.x;
		double a_y = v02.center.y - v00.center.y;

		double b_x = v20.center.x - v00.center.x;
		double b_y = v20.center.y - v00.center.y;

		return a_x * b_y - a_y * b_x < 0;
	}
private static boolean isClockWise ( Grid g ) { EllipseRotated_F64 v00 = g . get ( 0 , 0 ) ; EllipseRotated_F64 v02 = g . columns < 3 ? g . get ( 1 , 1 ) : g . get ( 0 , 2 ) ; EllipseRotated_F64 v20 = g . rows < 3 ? g . get ( 1 , 1 ) : g . get ( 2 , 0 ) ; double a_x = v02 . center . x - v00 . center . x ; double a_y = v02 . center . y - v00 . center . y ; double b_x = v20 . center . x - v00 . center . x ; double b_y = v20 . center . y - v00 . center . y ; return a_x * b_y - a_y * b_x < 0 ; }
Uses the cross product to determine if the grid is in clockwise order