Given a circle with a given radius has its centre at a particular position in the coordinate plane. In the coordinate plane, another point is given. The task is to find the shortest distance between the point and the circle.
Input: x1 = 4, y1 = 6, x2 = 35, y2 = 42, r = 5 Output: 42.5079 Input: x1 = 0, y1 = 0, x2 = 5, y2 = 12, r = 3 Output: 10
which is equal to (d-r)
d = √((x2-x1)^2 – (y2-y1)^2)
Below is the implementation of the above approach:
The shortest distance between a point and a circle is 42.5079
- Shortest distance from the centre of a circle to a chord
- Shortest distance between a Line and a Point in a 3-D plane
- Find the shortest distance between any pair of two different good nodes
- Check whether it is possible to join two points given on circle such that distance between them is k
- Distance between a point and a Plane in 3 D
- Neighbors of a point on a circle using Bresenham's algorithm
- Check whether a point exists in circle sector or not.
- Find if a point lies inside a Circle
- Perpendicular distance between a point and a Line in 2 D
- Find the radii of the circles which are lined in a row, and distance between the centers of first and last circle is given
- Find minimum radius such that atleast k point lie inside the circle
- Optimum location of point to minimize total distance
- Find the minimum sum of distance to A and B from any integer point in a ring of size N
- Ratio of the distance between the centers of the circles and the point of intersection of two transverse common tangents to the circles
- Ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles
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.