// https://es.wikipedia.org/wiki/Coordenadas_polares
public class Point {
    private double r;
    private double a;
    public Point(double x, double y) {
        this.r = Math.sqrt(Math.pow(x,2) + Math.pow(y,2));
                     if (x> 0 && y>=0) this.a = Math.atan(y/x);
        else if (x>0  && y< 0) this.a = (2*Math.PI + Math.atan(y/x)) ;
        else if (x==0 && y> 0) this.a = Math.PI/2;
        else if (x< 0        ) this.a = Math.atan(y/x) + Math.PI;
        else if (x==0 && y< 0) this.a = 3*Math.PI/2;
        else                   this.a = 0; 
        this.a = this.a * 180 / Math.PI;
    }
    public double getX() {
        return this.r * Math.cos(this.a);
    }
    public double getY() {
        return this.r * Math.sin(this.a);
    }
    public double getR() {
        return this.r;
    }
    public double getAngulo() {
        return this.a;
    }
    @Override
    public String toString() {
        return "(x=" + getX() + ",y=" + getY() + ")";
    }
    public String toStringPolar() {
        return "(r=" + this.r + ",angulo=" + this.a + ")";
    }
}
