Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.graphics.PointF;

public class Main {
    public static boolean withPointRadius(int x, int y, PointF target, float radius) {
        PointF cur = new PointF(x, y);
        return withPointRadius(cur, target, radius);
    }

    public static boolean withPointRadius(float x, float y, PointF target, float radius) {
        PointF cur = new PointF(x, y);
        return withPointRadius(cur, target, radius);
    }

    public static boolean withPointRadius(PointF cur, PointF target, float radius) {
        double space_2 = Math.pow(Math.abs(cur.x - target.x), 2) + Math.pow(Math.abs(cur.y - target.y), 2);
        double space = Math.sqrt(space_2);
        if (radius > space) {
            return true;
        }
        return false;
    }
}