is Circumference In Rectangle - Android java.lang

Android examples for java.lang:Math Trigonometric Function

Description

is Circumference In Rectangle

Demo Code


//package com.java2s;

public class Main {
    public static boolean isCircumferenceInRectangle(float circX,
            float circY, float radius, float rectX0, float rectY0,
            float rectX1, float rectY1) {
        if (circX - radius < rectX0) {
            return false;
        }//from  w  ww.j  a  v  a2  s .c o  m
        if (circX + radius > rectX1) {
            return false;
        }
        if (circY - radius < rectY0) {
            return false;
        }
        if (circY + radius > rectY1) {
            return false;
        }
        return true;
    }
}

Related Tutorials