Given the radius and coordinates of the centre of a circle. Find the quadrant in which another given coordinate (X, Y) lies with respect to the centre of circle if the point lies inside the circle. Else print an error “Lies outside the circle”.
If the point lies at the centre of circle output 0 or if the point lies on any of the axes and inside the circle output the next quadrant in anti-clock direction.
Input : Centre = (0, 0), Radius = 10
(X, Y) = (10, 10)
Output : Lies Outside the Circle
Input : Centre = (0, 3), Radius = 2
(X, Y) = (1, 4)
Output : 1 (I quadrant)
Let center be (x’, y’)
Equation of circle is – (Eq. 1)
According to this equation,
If point (x, y) lies outside of circle
If point (x, y) lies on the circle
If point (x, y) lies inside of circle
To check position of point with respect to circle:-
1. Put given coordinates in equation 1. 2. If it is greater than 0 coordinate lies outside circle. 3. If point lies inside circle find the quadrant within the circle. Check the point with respect to centre of circle.
Below is the implementation of above idea :
- Check if possible to move from given coordinate to desired coordinate
- Program to determine the quadrant of the cartesian plane
- Program to calculate area of inner circle which passes through center of outer circle and touches its circumference
- Number of possible Triangles in a Cartesian coordinate system
- Lexicographically Kth smallest way to reach given coordinate from origin
- Check if a circle lies inside another circle or not
- Equation of circle when three points on the circle are given
- Find area of the larger circle when radius of the smaller circle and difference in the area is given
- Angle subtended by the chord to center of the circle when the angle subtended by the another equal chord of a congruent circle is given
- Stein's Algorithm for finding GCD
- Finding all subsets of a given set in Java
- Finding LCM of more than two (or array) numbers without using GCD
- Finding n-th term of series 3, 13, 42, 108, 235…
- Finding power of prime number p in n!
- Finding the best fit rectangle that covers a given point
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.