Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Gavino" Newsgroups: comp.lang.java.programmer Subject: Re: Programming question determining two circle's relation Date: Sat, 30 Apr 2011 17:59:22 +0200 Lines: 18 Message-ID: <922pulFd6lU1@mid.individual.net> References: <892252a0-e31d-426b-8f47-d37c0b2ec364@17g2000prr.googlegroups.com> <511ca68f-7866-4658-9b2b-b1c0c013a030@a21g2000prj.googlegroups.com> <1598343d-42e2-4a65-9677-20c12675b174@n2g2000prj.googlegroups.com> X-Trace: individual.net L5T8Gu7DG2hxVMuCaIzFQAeea1drRndaPcaKJsJigpNCVne91N Cancel-Lock: sha1:oaZJWxRWOevCLL1JxEx+3yaZWXU= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3377 "byhesed" wrote in message news:1598343d-42e2-4a65-9677-20c12675b174@n2g2000prj.googlegroups.com... >Sorry, there were errors in my source code in determining the position >of two circles. >public boolean contains(double x, double y) { >double distance = Math.sqrt(Math.pow(getX() - x, 2.0) + >Math.pow(getY() - y, 2.0)); >if (distance <= Math.sqrt(radius)) You're going backwards. This should be if (distance <= radius) The others are still wrong too - see my previous post.