Calculate the rectangular ratio and save them
for ( int i = 0 ; i < rows ; i ++ ) { double rectRatio = ( double ) sides [ i , 0 ] / sides [ i , 1 ] ; if ( ! ratio . ContainsKey ( rectRatio ) ) { ratio [ rectRatio ] = 0 ; } ratio [ rectRatio ] = ratio [ rectRatio ] + 1 ; }