Given two circles of radius r and R, both have their centre at the origin. Now, given another circle of radius r1 and centre at (x1, y1). Check, if the third circle(circle of radius r1) lies completely inside the ring formed by two circles of radius r and R.
Input : r = 8 R = 4 r1 = 2 x1 = 6 y1 = 0 Output : yes Input : r = 8 R = 4 r1 = 2 x1 = 5 y1 = 0 Output : no
Important : Concentric circles are those circles which have same centre. The region lying between two concentric circles is called annulus or the circular ring.
There are two concentric circles with their centre at origin(0, 0) and radius as r = 8 and R = 4.
1.) Circle 1 and 2 lies inside the ring.
2.) Circle 3 and 4 are outside the ring.
The complete figure can be visualised as given below :
This problem can be solved using Pythagoras Theorem . Compute the distance between the centre of the circle and origin using Pythagoras theorem, suppose it is denoted by ‘dis’.
After computing the distance just check that the value of (dis – r1)> = r and (dis + r1)< = R. If both these conditions hold then the circle lies completely inside the ring.
- Find if a point lies inside a Circle
- How to check if a given point lies inside or outside a polygon?
- Check if a point lies on or inside a rectangle | Set-2
- Check whether a given point lies inside a rectangle or not
- Check whether a given point lies on or inside the rectangle | Set 3
- Check whether a point lies inside a sphere or not
- Check whether a given point lies inside a triangle or not
- Check whether given circle resides in boundary maintained by two other circles
- Program to calculate the area between two Concentric Circles
- Find a point that lies inside exactly K given squares
- Queries on count of points lie inside a circle
- Find minimum radius such that atleast k point lie inside the circle
- Check if two given circles touch or intersect each other
- Check whether the point (x, y) lies on a given line
- Check if a point is inside, outside or on the parabola
Improved By : jit_t