public float convex ( float [ ] x , int m ) { float result = ( float ) 1.0 ; int M = x . length ; for ( int i = 1 ; i <= M - m ; i ++ ) { result *= ( 1 - Math . cos ( x [ i - 1 ] * Math . PI * 0.5 ) ) ; } if ( m != 1 ) { result *= ( 1 - Math . sin ( x [ M - m ] * Math . PI * 0.5 ) ) ; } return result ; }
Calculate a convex shape