C# 控制台应用程序如何检查请求点在半径为 10 的主要点 (-3,4) 内
C# Console app How to check requested point is inside the main point(-3,4) with radius 10
我正在制作一个程序,它检查用户请求的点是否在主点 (-3,4) 的半径 (10) 内。我不知道如何检查它。请帮助我!
例如:用户需要知道 -5,3 在主点内 (-3,4)
int radius = 10; //Radius
new Point(-5,3); //User's point
new Point(-3,4); //Main point
您需要使用以下公式检查两点之间的距离
Math.Sqrt(Math.Pow((x2-x1),2)+Math.Pow((y2-y1),2))
如果该值小于半径。然后 Point 位于圆内。