编程语言
首页 > 编程语言> > C# 判断一个坐标点是否在圆内

C# 判断一个坐标点是否在圆内

作者:互联网

        /// <summary>
        /// 连点之间距离公式判断坐标是否在圆内,√[(x1-x2)²+(y1-y2)²]
        /// </summary>
        /// <param name="p"></param>
        /// <param name="f"></param>
        /// <param name="r"></param>
        /// <returns></returns>
        public string inoutCircle(PointF p, PointF f, double r)
        {
            double distanceBetPoints;//两点之间距离
            distanceBetPoints = Math.Pow(Math.Pow(p.X - f.X, 2) + Math.Pow(p.Y - f.Y, 2), 0.5);
            if (distanceBetPoints <= r)
            {
                return "in";
            }
            else
            {
                return "out";
            }
        }

 

标签:PointF,C#,Pow,Math,圆内,double,distanceBetPoints,坐标
来源: https://www.cnblogs.com/blossomwei/p/16493451.html