programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Liutauras Vilda
• Jeanne Boyarsky
• Devaka Cooray
• Paul Clapham
Sheriffs:
• Tim Cooke
• Knute Snortum
• Bear Bibeault
Saloon Keepers:
• Ron McLeod
• Tim Moores
• Stephan van Hulst
• Piet Souris
• Ganesh Patekar
Bartenders:
• Frits Walraven
• Carey Brown
• Tim Holloway

# Touching or Intersecting circles

Ranch Hand
Posts: 33
I'm writing a program that will have to determine if two circle touch; and if two other circles touch.
I have my code set up to retrieve the values necessary for this exercise and have been able to output them for data verification. I just need some help with my formulas.
I would like to use a few simple Boolean expressions to determine these facts.

lowercase baba
Posts: 12749
51
do YOU know how to do it? I don't me write java code, I mean work it out with paper and pencil, using algebra. That is the first step.

Kirstie Fran
Ranch Hand
Posts: 33
yes, i have found a few explanaitions online, but they are fairly involved, and i'm not sure if i can convert it all into coharent code.

http://mathworld.wolfram.com/Circle-CircleIntersection.html

Ranch Hand
Posts: 58
I don't know what level of algebra you are comfortable with, but you are unnecessarily complicating things by looking at the link you posted (everything in there is of course correct, but a lot of the calculations are for things you do not care about for your intersection or touching methods). Forget about algebra even, just think visually. If you had two circles in front of you, at what point do they touch? What happens when they start intersecting? Can you relate that to any geometric parameters?

If you've ever used a drafting compass, this would be even easier to grasp. Take some time and think about it. Don't rush head first into writing the code without having a clear idea of what you need to do and what the logic for the program/method is going to be.

 With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.