Question

Give a randomized incremental algorithm which given n circles in the plane, reports the point with greatest y coordinate that lies inside all of the circles.

Here, "the point with greatest y coordinate that lies inside all of the circles" means the point with greatest y coordinate among intersection points of all circles

greatet

Please give the pseudo-code! Thank you

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Algo

1. take two circles and find their point of intersection if any.

to find point of intersection do the following

0

First calculate the distance d between the center of the circles. d = ||P1 - P0||.

  • If d > r0 + r1 then there are no solutions, the circles are separate.
  • If d < |r0 - r1| then there are no solutions because one circle is contained within the other.
  • If d = 0 and r0 = r1 then the circles are coincident and there are an infinite number of solutions.

Considering the two triangles P0P2P3 and P1P2P3 we can write

a2 + h2 = r02 and b2 + h2 = r12

Using d = a + b we can solve for a,

a = (r02 - r12 + d2 ) / (2 d)

It can be readily shown that this reduces to r0 when the two circles touch at one point, ie: d = r0 + r1

Solve for h by substituting a into the first equation, h2 = r02 - a2

So

P2 = P0 + a ( P1 - P0 ) / d

And finally, P3 = (x3,y3) in terms of P0 = (x0,y0), P1 = (x1,y1) and P2 = (x2,y2), is

x3 = x2 +- h ( y1 - y0 ) / d

y3 = y2 -+ h ( x1 - x0 ) / d

2. after finding P3 put the point in equation of other n-2 circles to see if it lie inside, outside or on the circle

if valueevaluates to <0 inside circle

=0 on circle

>0 outside circle

3. for points inside or on (<=0) all n-2 circle store the y coordinate

4 repeat step 1,2 and 3 for all pairs of circle

5. find max of all y coordinate stored in step 3

Add a comment
Know the answer?
Add Answer to:
Give a randomized incremental algorithm which given n circles in the plane, reports the point with...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT