Cartesian To Polar Coordinate - Java Algorithm

Java examples for Algorithm:Geometry

Description

Cartesian To Polar Coordinate

Demo Code



public class CartesianToPolar {
    public static void main(String args[]) {
        double x = 12;
        double y = 5;
        double r = Math.sqrt(x * x + y * y);
        System.out.println("r is " + r);
        double thetha = Math.toDegrees(Math.atan2(y, x));
        System.out.println("thetha is " + thetha);

    }//  w w w .j a  v  a 2  s.com

}

Related Tutorials