Android_Learner Android_Learner -5 years ago 165
Android Question

how to find radius of a circle if centre point is given?

i want to find radius for a circle to be drawn in future. the data i have is the centre point haveing a X and a Y.

Answer Source

I am going to assume that the question is:

How can I get the radius of a circle that I know the center of, based on a point related to that center. In Java or Dalvik (Android)

From a Math point of view, the distance between two points in the same plane is the square root of the sum from the power of two from each side in a triangle:

From wikipedia:



private double getRadius(Point a, Point circleCenter){
   return Math.sqrt(Math.pow(Math.abs(a.x)-Math.abs(circleCenter.x),2)+Math.pow(Math.abs(a.y)-Math.abs(circleCenter.y),2));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download