public static void AdjustCurve(ref PointF[] m_pointArray) { int num1 = m_pointArray.Length; if (num1 >= 3) { double num8; bool flag1 = false; int num2 = 0; int num3 = 0; double num7 = num8 = BezierFunc.CalcAngle(m_pointArray[0], m_pointArray[1]); ArrayList list1 = new ArrayList(0x10); for (int num9 = 0; num9 < (num1 - 2); num9++) { double num4 = BezierFunc.CalcAngle(m_pointArray[num9], m_pointArray[num9 + 1]); double num5 = BezierFunc.CalcAngle(m_pointArray[num9 + 1], m_pointArray[num9 + 2]); num7 = BezierFunc.LesserData(num7, BezierFunc.LesserData(num4, num5)); num8 = BezierFunc.BiggishData(num8, BezierFunc.BiggishData(num4, num5)); Debug.Assert(num8 >= num7); double num6 = Math.Abs((double)(num8 - num7)); if (!flag1) { if (num6 > 0.39269908169872414) { flag1 = true; if (BezierFunc.PointLine(m_pointArray[num2], m_pointArray[num3], m_pointArray[num9]) > 4) { num3 = num9 + 1; } list1.Add(m_pointArray[num9 + 2]); num7 = num8 = BezierFunc.CalcAngle(m_pointArray[num9 + 1], m_pointArray[num9 + 2]); } else { num3 = num9 + 1; } } else { Debug.Assert(num3 >= 0); if (num6 > 0.39269908169872414) { Debug.Assert((num3 >= num2) && (num9 >= num3)); if (BezierFunc.PointLine(m_pointArray[num2], m_pointArray[num3], m_pointArray[num9]) < 4) { BezierFunc.AddjustPoints(list1, m_pointArray[num2], m_pointArray[num3]); flag1 = false; } else { num2 = num3; num3 = num9 + 1; Debug.Assert((num2 >= 0) && (num2 < num1)); } num7 = num8 = BezierFunc.CalcAngle(m_pointArray[num9 + 1], m_pointArray[num9 + 2]); } list1.Add(m_pointArray[num9 + 2]); } } m_pointArray = new PointF[list1.Count]; list1.CopyTo(m_pointArray); } }
private static double PointLine(PointF cPoint1, PointF cPoint2, PointF cPoint) { return(BezierFunc.PointLine((double)cPoint1.X, (double)cPoint1.Y, (double)cPoint2.X, (double)cPoint2.Y, (double)cPoint.X, (double)cPoint.Y)); }