public static double [ ] rotate90Equals ( final double [ ] v1 ) { assert v1 . length == 2 : "rotate90Equals is only valid for 2d vectors." ; final double temp = v1 [ 0 ] ; v1 [ 0 ] = v1 [ 1 ] ; v1 [ 1 ] = - temp ; return v1 ; }
Rotate the two - dimensional vector by 90 degrees .