Gyula Nemeth
Gyula Nemeth

Reputation: 15

C# Console app How to check requested point is inside the main point(-3,4) with radius 10

I am making a program, which checks if a user's requested point is inside the radius(10) of main point(-3,4). I don't know how to check it. Please help me!

For Example: User needs to know -5,3 is inside the main point (-3,4)

int radius = 10; //Radius

new Point(-5,3); //User's point

new Point(-3,4); //Main point

Upvotes: 0

Views: 102

Answers (1)

Gowri Pranith Kumar
Gowri Pranith Kumar

Reputation: 1685

You need to check the distance between the 2 points using the below formula

Math.Sqrt(Math.Pow((x2-x1),2)+Math.Pow((y2-y1),2)) 

if the value is less than the radius . then the Point lies inside the circle .

Upvotes: 1

Related Questions