Here you can find the source of intersects(float cx, float cy, float radius, float left, float top, float right, float bottom)
public static boolean intersects(float cx, float cy, float radius, float left, float top, float right, float bottom)
//package com.java2s; /*----------------------------------------------------------------------------- * vlsSMLM Software// ww w . j a v a 2 s .c o m * * Copyright (C) 2014 Matthieu Palayret * Department of Chemistry * University of Cambridge, UK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. *---------------------------------------------------------------------------*/ public class Main { public static boolean intersects(float cx, float cy, float radius, float left, float top, float right, float bottom) { float closestX = (cx < left ? left : (cx > right ? right : cx)); float closestY = (cy < top ? top : (cy > bottom ? bottom : cy)); float dx = closestX - cx; float dy = closestY - cy; return (dx * dx + dy * dy) <= radius * radius; } }