Math, asked by rajkumarisingh2297, 6 hours ago

हाउ मेनी कमेंट 10 जून कैन विड्रॉ टू सर्कल टचिंग एक्सटर्नली​

Answers

Answered by gyaneshwarsingh882
0

Answer:

Step-by-step explanation:

Number of common tangents between two circles if their centers and radius is given

Last Updated : 19 Apr, 2021

Given two circles with a given radius and centres. The task is to find the number of common tangents between these circles.

Examples:  

 

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

Approach:  

 

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.

Below is the implementation of the above approach:

// C++ program to find

// the number of common tangents

// between the two circles

 

#include <bits/stdc++.h>

using namespace std;

 

int circle(int x1, int y1, int x2,

       int y2, int r1, int r2)

{

 

   int distSq = (x1 - x2) * (x1 - x2)

               + (y1 - y2) * (y1 - y2);

 

   int radSumSq = (r1 + r2) * (r1 + r2);

 

   if (distSq == radSumSq)

       return 1;

   else if (distSq > radSumSq)

       return -1;

   else

       return 0;

}

 

/

Similar questions