Calculate theta - Android android.graphics

Android examples for android.graphics:PointF

Description

Calculate theta

Demo Code

import android.graphics.PointF;

public class Main{

    public static double theta(PointF p) {
        return Math.atan2(p.x, p.y);
    }//from   ww w . j av  a2  s  . c  om
    public static double theta(PointF p, PointF o) {
        PointF v = new PointF();
        v.x = p.x - o.x;
        v.y = p.y - o.y;
        return theta(v);
    }
    public static double theta(PointF p) {
        return Math.atan2(p.x, p.y);
    }
    public static double theta(PointF p, PointF o) {
        PointF v = new PointF();
        v.x = p.x - o.x;
        v.y = p.y - o.y;
        return theta(v);
    }

}

Related Tutorials