public override bool GetNearestIntersectionPoint(PointF p1, PointF p2, out PointF result) { RectangleF ef1 = this.Bounds; float single1 = base.InternalPenWidth / 2f; DiagramShape.InflateRect(ref ef1, single1, single1); return(EllipseGraph.NearestIntersectionOnEllipse(ef1, p1, p2, out result)); }
public override bool GetNearestIntersectionPoint(PointF p1, PointF p2, out PointF result) { PointF tf1; RectangleF ef1 = this.Bounds; float single1 = base.InternalPenWidth / 2f; DiagramShape.InflateRect(ref ef1, single1, single1); float single2 = ef1.Width / 2f; float single3 = ef1.Height / 2f; float single4 = ef1.X + single2; float single5 = ef1.Y + single3; float single6 = p1.X - single4; float single7 = p1.Y - single5; float single8 = this.StartAngle; float single9 = this.SweepAngle; float single10 = single8 + single9; if (single10 > 360f) { single10 -= 360f; } bool flag1 = false; float single11 = 1E+21f; result = new PointF(); if ((-0.01f < single6) && (single6 < 0.01f)) { single6 = 0.01f; } if ((-0.01f < single7) && (single7 < 0.01f)) { single7 = 0.01f; } if (single9 >= 360f) { if (EllipseGraph.NearestIntersectionOnEllipse(ef1, p1, p2, out tf1)) { float single12 = ((p1.X - tf1.X) * (p1.X - tf1.X)) + ((p1.Y - tf1.Y) * (p1.Y - tf1.Y)); if (single12 < single11) { flag1 = true; result = tf1; single11 = single12; } } } else if ((single9 + single8) > 360f) { if (EllipseGraph.NearestIntersectionOnArc(ef1, p1, p2, out tf1, single8, 360f - single8)) { float single13 = ((p1.X - tf1.X) * (p1.X - tf1.X)) + ((p1.Y - tf1.Y) * (p1.Y - tf1.Y)); if (single13 < single11) { flag1 = true; result = tf1; single11 = single13; } } if (EllipseGraph.NearestIntersectionOnArc(ef1, p1, p2, out tf1, 0f, single9 - (360f - single8))) { float single14 = ((p1.X - tf1.X) * (p1.X - tf1.X)) + ((p1.Y - tf1.Y) * (p1.Y - tf1.Y)); if (single14 < single11) { flag1 = true; result = tf1; single11 = single14; } } } else if (EllipseGraph.NearestIntersectionOnArc(ef1, p1, p2, out tf1, single8, single9)) { float single15 = ((p1.X - tf1.X) * (p1.X - tf1.X)) + ((p1.Y - tf1.Y) * (p1.Y - tf1.Y)); if (single15 < single11) { flag1 = true; result = tf1; single11 = single15; } } PointF tf2 = this.GetPointAtAngle(single8); if (StrokeGraph.NearestIntersectionOnLine(new PointF(single4, single5), tf2, p1, p2, out tf1)) { float single16 = ((p1.X - tf1.X) * (p1.X - tf1.X)) + ((p1.Y - tf1.Y) * (p1.Y - tf1.Y)); if (single16 < single11) { flag1 = true; result = tf1; single11 = single16; } } PointF tf3 = this.GetPointAtAngle(single10); if (StrokeGraph.NearestIntersectionOnLine(new PointF(single4, single5), tf3, p1, p2, out tf1)) { float single17 = ((p1.X - tf1.X) * (p1.X - tf1.X)) + ((p1.Y - tf1.Y) * (p1.Y - tf1.Y)); if (single17 < single11) { flag1 = true; result = tf1; single11 = single17; } } return(flag1); }