System.Drawing.PieChart.PieSlice.GetTextPosition C# (CSharp) Method

GetTextPosition() public method

Evaluates the point in the middle of the slice.
public GetTextPosition ( ) : PointF
return System.Drawing.PointF
        public virtual PointF GetTextPosition()
        {
            if (SweepAngle >= 180)
                return PeripheralPoint(m_center.X, m_center.Y, m_boundingRectangle.Width / 3, m_boundingRectangle.Height / 3, GetActualAngle(StartAngle) + SweepAngle / 2);
            float x = (m_pointStart.X + m_pointEnd.X) / 2;
            float y = (m_pointStart.Y + m_pointEnd.Y) / 2;
            float angle = (float)(Math.Atan2(y - m_center.Y, x - m_center.X) * 180 / Math.PI);
            return PeripheralPoint(m_center.X, m_center.Y, m_boundingRectangle.Width / 3, m_boundingRectangle.Height / 3, GetActualAngle(angle));
        }