Answers for "polar to cartesian java"

2

java cartesian to polar

public static double[] pol(double x, double y) {
	//return new double[]{Math.sqrt(x * x + y * y), Math.atan2(y, x)}; //red
	return new double[]{Math.sqrt(x * x + y * y), (Math.atan2(y, x) * 180) / Math.PI}; //cart
}
Posted by: Guest on January-06-2021
1

polar to cartesian java

static double[] cari(double r, double theta) {
    theta = (theta / 180) * Math.PI;
    return new double[]{r * Math.cos(theta), r * Math.sin(theta)};
}
Posted by: Guest on January-06-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language