-5

We have a red circle with radius 10. On this red cicle, there is 3 other circles in blue (radius 8) that are equally spaced by 120°. The point C is the middle of two blue circle and has a green circle (radius 2).

I need to find the coordinate and radius of the yellow circle that touch the two blue circle and the green on the same time. I know how to make a circle with 3 points but the yellow circle must only touch the 3 others. Only 1 point intersection on each circles.

On the picture, we can see it's not correct. The yellow circle touch on 2 point a blue circle.

In the example there is 3 blue circle but it should work with 2, 3, 4, and 5 blue circles equally spaced on the red circle.

I'm on this problem for days now, help...

I try to do it for iphone but any piece of code is welcome.

https://i.stack.imgur.com/JwO8L.png

5
  • 1
    Is this really related to iOS? Isn't your problem more a maths/geometry issue?
    – Larme
    May 22, 2015 at 13:45
  • I can't even see the yellow circle haha.
    – Gil Sand
    May 22, 2015 at 13:48
  • It's related to ios because i need to find the code that calculate the center and radius of the yellow circle on IOS. But yes, it's at start a geometry issue.
    – StackDev67
    May 22, 2015 at 14:01
  • 1
    I'm voting to close this question as off-topic because it is a math question and belongs on math.stackexchange.com
    – rmaddy
    May 22, 2015 at 15:43
  • 1
    Once you know the math involved, attempt to write the desired code. When you have a specific coding issue implementing the math formula, them come back here and post your code and explain what issue you are having.
    – rmaddy
    May 22, 2015 at 15:44

2 Answers 2

0

Let's

blue radius = R
green radius = r
unknown yellow radius is F
and |BC| = P

then |GB| = R + F, because radii to touch point are perpendicular to common tangent, so they are collinear, and for right-angle BGC triangle

(R + F)^2 = (r + F)^2 + P^2 (due to Pythagorean theorem)

R^2 + 2*R*F+F^2 = r^2 + 2*r*F + F^2 + P^2
2F*(R-r) = P^2 + r^2 -R^2
and finally
F = (P^2 + r^2 -R^2) / (2*(R-r))

for your case R = 8, r = 2, P = 10*Sin(Pi/3)=5 *Sqrt(3), P^2 = 75

F = (75 + 4 - 64) / (2 * (8 - 2)) = 15/12 = 5/4

Sketch (another point names): enter image description here

2
  • Thanks, i have to understand all this first but the value of the yellow circle could be 5/4 from what i see in geogebra
    – StackDev67
    May 22, 2015 at 15:40
  • It works, thanks you a lot !!!!! With the radius of the yellow circle i have every value i need to draw it. Looks so easy for you, i was on it sooo much time.
    – StackDev67
    May 22, 2015 at 16:13
0

I think this is quite simple if you have their positions and radius values. You can just compare if the distance between the yellow circle and the target circles matches the desired values:

to find the distance between two points (1 and 2) we would use the equation d=sqrt((x2-x1)^2+(y2-y1)^2).

But we have to take into consideration their radius, so we just need to compare if the distance between a point on the edge of the yellow circle could be within the target circle considering the target circle's radius. radius.

iOS has these math functions available, so we can turn that equation above into something like this:

- (BOOL)yellowCircleCrossesTargetCircleWithCenter:(CGPoint)center andRadius:(CGFloat)radius {
    //consider x, y, r and the like, like real numbers.
    //this is just an example

    CGPoint yellowCircle = CGPointMake(x,y);
    CGFloat yellowCircleRadius = r;
    CGPoint targetCircle = center
    CGFloat targetCircleRadius = radius;

    double distance = sqrt(pow(targtetCircle.x-yellowCircle.x)+pow(targetCircle.y-yellowCircle.y));

    BOOL isAboveMinimumLimit = (yellowCircleRadius - targetCircleRadius) < distance;
    BOOL isBelowMaximumLimit = (yellowCircleRadius + targetCircleRadius) > distance;

    return isAboveMinimumLimit && isBelowMaximumLimit;
        //returns YES if yellow circle's border crosses the target circle
}

You would have to run this for every circle you want to check. if all the circles return YES then yellow crosses them all.

2
  • Sorry but i don't want to know if they touch, i need to find the coordinate and radius of yellow circle
    – StackDev67
    May 22, 2015 at 15:37
  • I guess i misunderstood then. Sorry :)
    – Erakk
    May 22, 2015 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.