public static ResultSet polar2Cartesian(Double r,Double alpha){
  SimpleResultSet rs=new SimpleResultSet();
  rs.addColumn("X",Types.DOUBLE,0,0);
  rs.addColumn("Y",Types.DOUBLE,0,0);
  if (r != null && alpha != null) {
    double x=r.doubleValue() * Math.cos(alpha.doubleValue());
    double y=r.doubleValue() * Math.sin(alpha.doubleValue());
    rs.addRow(x,y);
  }
  return rs;
}

public static ResultSet polar2Cartesian ( Double r , Double alpha ) { SimpleResultSet rs = new SimpleResultSet ( ) ; rs . addColumn ( "X" , Types . DOUBLE , 0 , 0 ) ; rs . addColumn ( "Y" , Types . DOUBLE , 0 , 0 ) ; if ( r != null && alpha != null ) { double x = r . doubleValue ( ) * Math . cos ( alpha . doubleValue ( ) ) ; double y = r . doubleValue ( ) * Math . sin ( alpha . doubleValue ( ) ) ; rs . addRow ( x , y ) ; } return rs ; }
convert polar coordinates to cartesian coordinates . the function may be called twice , once to retrieve the result columns ( with null parameters ) , and the second time to return the data .
