Stores the coordinates of the vertices of the triangles
int n = rectangle . size ( ) ; ArrayList < ArrayList < Integer > > triangle1 = new ArrayList < ArrayList < Integer > > ( ) ; for ( int i = 1 ; i < n ; i ++ ) triangle1 . add ( rectangle . get ( i ) ) ; ArrayList < ArrayList < Integer > > triangle2 = new ArrayList < ArrayList < Integer > > ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { triangle2 . add ( rectangle . get ( i ) ) ; } ArrayList < ArrayList < Integer > > triangle3 = new ArrayList < ArrayList < Integer > > ( ) ; for ( int i = 0 ; i < 2 ; i ++ ) { triangle3 . add ( rectangle . get ( i ) ) ; } triangle3 . add ( rectangle . get ( 3 ) ) ; ArrayList < ArrayList < Integer > > triangle4 = new ArrayList < ArrayList < Integer > > ( ) ; for ( int i = n - 2 ; i < n ; i ++ ) { triangle4 . add ( rectangle . get ( i ) ) ; } triangle4 . add ( rectangle . get ( 0 ) ) ;