转自:https://blog.csdn.net/chenlu5201314/article/details/99678398

椭圆公式 

椭圆半径公式如下

椭圆坐标公式

角度转弧度公式

弧度转角度公式

  •  为半径
  •  为横轴(长轴)
  •  为竖轴(短轴)
  •  为任意角度/弧度,
  •  为椭圆上  对应的横坐标
  •  为椭圆上  对应的纵坐标
  •  弧度
  •  角度

C#代码

        /// <summary>
        /// 椭圆求点公式
        /// </summary>
        /// <param name="lpRect">椭圆边框</param>
        /// <param name="angle">角度</param>
        /// <returns></returns>
        public Point GetArcPoint(Rectangle lpRect, float angle)
        {
            Point pt = new Point();
            double a = lpRect.Width / 2.0f;
            double b = lpRect.Height / 2.0f;
            if (a == 0 || b == 0) return new Point(lpRect.X, lpRect.Y);

            //弧度
            double radian = angle * Math.PI / 180.0f;

            //获取弧度正弦值
            double yc = Math.Sin(radian);
            //获取弧度余弦值
            double xc = Math.Cos(radian);
            //获取曲率  r = ab/\Sqrt((a.Sinθ)^2+(b.Cosθ)^2
            double radio = (a * b) / Math.Sqrt(Math.Pow(yc * a, 2.0) + Math.Pow(xc * b, 2.0));

            //计算坐标
            double ax = radio * xc;
            double ay = radio * yc;
            pt.X = (int)(lpRect.X + a + ax);
            pt.Y = (int)(lpRect.Y + b + ay);
            return pt;
        }
01-21 01:25