private static boolean between ( int [ ] verts , int a , int b , int c ) { if ( ! collinear ( verts , a , b , c ) ) return false ; // If ab not vertical, check betweenness on x; else on y. if ( verts [ a + 0 ] != verts [ b + 0 ] ) return ( ( verts [ a + 0 ] <= verts [ c + 0 ] ) && ( verts [ c + 0 ] <= verts [ b + 0 ] ) ) || ( ( verts [ a + 0 ] >= verts [ c + 0 ] ) && ( verts [ c + 0 ] >= verts [ b + 0 ] ) ) ; else return ( ( verts [ a + 2 ] <= verts [ c + 2 ] ) && ( verts [ c + 2 ] <= verts [ b + 2 ] ) ) || ( ( verts [ a + 2 ] >= verts [ c + 2 ] ) && ( verts [ c + 2 ] >= verts [ b + 2 ] ) ) ; }
on the closed segement ab .