Given two circles with a given radius and centres. The task is to find the number of common tangents between these circles.
Input: x1 = -10, y1 = 8, x2 = 14, y2 = -24, r1 = 30, r2 = 10 Output: 3 Input: x1 = 40, y1 = 8, x2 = 14, y2 = 54, r1 = 39, r2 = 51 Output: 2
- First of all we will check whether the circles touch each other externally, intersect each other or do not touch each other at all.(Please refer here)
Then if the circles do not touch each other externally, then obviously they will have 4 common tangents, two direct and two transverse.
If the circles touch each other externally, then they will have 3 common tangents, two direct and one transverse.
The tangent in between can be thought of as the transverse tangents coinciding together.
If the circles intersect each other, then they will have 2 common tangents, both of them will be direct.
If one circle is inside another circle, then they will have only one common tangent.
- Ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles
- Ratio of the distance between the centers of the circles and the point of intersection of two transverse common tangents to the circles
- Distance between centers of two intersecting circles if the radii and common chord length is given
- Radii of the three tangent circles of equal radius which are inscribed within a circle of given radius
- Find the radii of the circles which are lined in a row, and distance between the centers of first and last circle is given
- Length of the perpendicular bisector of the line joining the centers of two circles
- Radius of the inscribed circle within three tangent circles
- Length of the transverse common tangent between the two non intersecting circles
- Length of the direct common tangent between two externally touching circles
- Length of direct common tangent between the two non-intersecting Circles
- Length of direct common tangent between two intersecting Circles
- Find the side of the squares which are lined in a row, and distance between the centers of first and last square is given
- Tangents between two Convex Polygons
- Maximum possible intersection by moving centers of line segments
- Number of triangles formed by joining vertices of n-sided polygon with two common sides and no common sides
- Divide the two given numbers by their common divisors
- Count of pairs in a given range with sum of their product and sum equal to their concatenated number
- Program to calculate the area between two Concentric Circles
- Check if two given circles touch or intersect each other
- Check whether given circle resides in boundary maintained by two other circles
Below is the implementation of the above approach:
There are 3 common tangents between the circles.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.