
-----------------------------------
silvervulcan
Sat Sep 27, 2003 4:46 pm

Need help writing a program!!!!!
-----------------------------------
Hey, can anyone help me out with this question:

Assume 2 circles located in an x-y coordinate space. Te first circle is centered at (x1,y1) and has diameter D1. THe second circle is centered at (x2,y2) and has diameter D2. There are 4 possible arrangements. Either

1. the circles do not touch each other at all OR
2.the circles touch but do not overlap OR
3. one of the circles completly overlaps the other OR
4. the circles partially overlap but neither completly overlaps the other

Write a program that read in the dic info (x1,y1,D1,x2,y2,D2) and outputs a message indicating which of the four cases applies. The program should also loop.

If entered diameters are zero,zero... program should end
but if the diameter is less than or equal to zero,  an error message should come up.

Someone plzzzzz help me, I dont know where to start  :cry:

-----------------------------------
AsianSensation
Sat Sep 27, 2003 5:17 pm


-----------------------------------
check distance between centers.
btw, work with radius instead of diameter

if distance is > r1 + r2, then they don't touch

if distance is = r1 + r2, then they are tangent

if distance is < r1 + r2, then they overlap partially

if distance is < the larger of the radius, or distance = 0, then they overlap completely.

what grade do you go to? have you learned circles and their graph yet?

-----------------------------------
silvervulcan
Sat Sep 27, 2003 10:08 pm


-----------------------------------
how do I find the distance between there centres?

-----------------------------------
Catalyst
Sat Sep 27, 2003 10:38 pm


-----------------------------------
distance=sqrt ( (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))

-----------------------------------
silvervulcan
Sat Sep 27, 2003 10:54 pm


-----------------------------------
okay say i have a line with conditions on it, but if none of those conditions are satisfied, I want it to go to the next set of conditons, test those, and if any of those are true then output a message

// Check for accepted values
if ((x1,y1 != x2,y2) && (d1 == d2) ) {

cout 0) && (y1,y2 != x1,x2) && (d1=d2)) 
			
cout  0)) 
			
cout  0)) || (( x1,y1 < 0) && (x2, y2 > 0) && (d1,d2 >0 ))) 

cout  square detection

-----------------------------------
Catalyst
Mon Sep 29, 2003 5:02 pm


-----------------------------------
if ur in c++ and 2d per-pixel is the best option

-----------------------------------
gigaman
Thu Dec 11, 2003 6:23 pm


-----------------------------------
I'm learnin MBs and an error message is if easy

if _______=true

MessageBox(NULL,"Fill in message here","Error",MB_OK")

-----------------------------------
Tony
Thu Dec 11, 2003 8:26 pm


-----------------------------------
thats cuz in if statments, you use ==
