get Circle Path Length - Android Graphics

Android examples for Graphics:Path

Description

get Circle Path Length

Demo Code


//package com.java2s;

public class Main {

    public static float getCirclePathLength(float radius, float angle) {
        angle = changeAngleToSingle(angle);
        return (float) (Math.PI * radius * angle / 180);
    }//from  w  ww . ja v  a  2  s.c o m

    public static float changeAngleToSingle(float angle) {
        while (angle >= 360) {
            angle -= 360;
        }
        while (angle < 0) {
            angle += 360;
        }
        return angle;
    }
}

Related Tutorials