public override bool GetNearestIntersectionPoint(PointF p1, PointF p2, out PointF result) { PointF tf5; RectangleF ef1 = this.Bounds; float single1 = base.InternalPenWidth / 2f; PointF[] tfArray1 = this.getPoints(); PointF tf1 = DiagramGraph.ExpandPointOnEdge(tfArray1[0], ef1, single1); PointF tf2 = DiagramGraph.ExpandPointOnEdge(tfArray1[1], ef1, single1); PointF tf3 = DiagramGraph.ExpandPointOnEdge(tfArray1[2], ef1, single1); PointF tf4 = DiagramGraph.ExpandPointOnEdge(tfArray1[3], ef1, single1); float single2 = p1.X; float single3 = p1.Y; float single4 = 1E+21f; PointF tf6 = new PointF(); if (StrokeGraph.NearestIntersectionOnLine(tf1, tf2, p1, p2, out tf5)) { float single5 = ((tf5.X - single2) * (tf5.X - single2)) + ((tf5.Y - single3) * (tf5.Y - single3)); if (single5 < single4) { single4 = single5; tf6 = tf5; } } if (StrokeGraph.NearestIntersectionOnLine(tf2, tf3, p1, p2, out tf5)) { float single6 = ((tf5.X - single2) * (tf5.X - single2)) + ((tf5.Y - single3) * (tf5.Y - single3)); if (single6 < single4) { single4 = single6; tf6 = tf5; } } if (StrokeGraph.NearestIntersectionOnLine(tf3, tf4, p1, p2, out tf5)) { float single7 = ((tf5.X - single2) * (tf5.X - single2)) + ((tf5.Y - single3) * (tf5.Y - single3)); if (single7 < single4) { single4 = single7; tf6 = tf5; } } if (StrokeGraph.NearestIntersectionOnLine(tf4, tf1, p1, p2, out tf5)) { float single8 = ((tf5.X - single2) * (tf5.X - single2)) + ((tf5.Y - single3) * (tf5.Y - single3)); if (single8 < single4) { single4 = single8; tf6 = tf5; } } result = tf6; return(single4 < 1E+21f); }
public override bool GetNearestIntersectionPoint(PointF p1, PointF p2, out PointF result) { PointF tf1; RectangleF ef1 = this.Bounds; float single1 = base.InternalPenWidth / 2f; float single2 = 1E+21f; PointF tf2 = new PointF(); if (this.Style == PolygonGraphStyle.Bezier) { for (int num1 = 3; num1 < this.myPointsCount; num1 += 3) { PointF tf3 = this.GetPoint(num1 - 3); PointF tf4 = this.GetPoint(num1 - 2); if ((num1 + 3) >= this.myPointsCount) { num1 = this.myPointsCount - 1; } PointF tf5 = this.GetPoint(num1 - 1); PointF tf6 = this.GetPoint(num1); if (StrokeGraph.BezierNearestIntersectionOnLine(tf3, tf4, tf5, tf6, p1, p2, out tf1)) { float single3 = ((tf1.X - p1.X) * (tf1.X - p1.X)) + ((tf1.Y - p1.Y) * (tf1.Y - p1.Y)); if (single3 < single2) { single2 = single3; tf2 = tf1; } } } } else { for (int num2 = 0; num2 < this.PointsCount; num2++) { PointF tf7 = DiagramGraph.ExpandPointOnEdge(this.GetPoint(num2), ef1, single1); PointF tf8 = DiagramGraph.ExpandPointOnEdge(this.GetPoint(((num2 + 1) < this.PointsCount) ? (num2 + 1) : 0), ef1, single1); if (StrokeGraph.NearestIntersectionOnLine(tf7, tf8, p1, p2, out tf1)) { float single4 = ((tf1.X - p1.X) * (tf1.X - p1.X)) + ((tf1.Y - p1.Y) * (tf1.Y - p1.Y)); if (single4 < single2) { single2 = single4; tf2 = tf1; } } } } result = tf2; return(single2 < 1E+21f); }
public override bool GetNearestIntersectionPoint(PointF p1, PointF p2, out PointF result) { PointF tf5; RectangleF ef2; RectangleF ef3; float single3; float single4; RectangleF ef1 = this.Bounds; float single1 = base.InternalPenWidth / 2f; PointF[] tfArray1 = this.getPoints(0f, 0f); PointF tf1 = DiagramGraph.ExpandPointOnEdge(tfArray1[0], ef1, single1); PointF tf2 = DiagramGraph.ExpandPointOnEdge(tfArray1[1], ef1, single1); PointF tf3 = DiagramGraph.ExpandPointOnEdge(tfArray1[2], ef1, single1); PointF tf4 = DiagramGraph.ExpandPointOnEdge(tfArray1[3], ef1, single1); float single2 = 1E+21f; PointF tf6 = new PointF(); if (this.Orientation == System.Windows.Forms.Orientation.Vertical) { ef2 = new RectangleF(ef1.X, ef1.Y, ef1.Width, this.MinorRadius * 2f); ef3 = new RectangleF(ef1.X, (ef1.Y + ef1.Height) - (this.MinorRadius * 2f), ef1.Width, this.MinorRadius * 2f); single3 = 180f; single4 = 0f; } else { ef2 = new RectangleF(ef1.X, ef1.Y, this.MinorRadius * 2f, ef1.Height); ef3 = new RectangleF((ef1.X + ef1.Width) - (this.MinorRadius * 2f), ef1.Y, this.MinorRadius * 2f, ef1.Height); single3 = 90f; single4 = 270f; } if (EllipseGraph.NearestIntersectionOnArc(ef2, p1, p2, out tf5, single3, 180f)) { float single5 = ((tf5.X - p1.X) * (tf5.X - p1.X)) + ((tf5.Y - p1.Y) * (tf5.Y - p1.Y)); if (single5 < single2) { single2 = single5; tf6 = tf5; } } if (this.Orientation == System.Windows.Forms.Orientation.Horizontal) { if (EllipseGraph.NearestIntersectionOnArc(ef3, p1, p2, out tf5, 270f, 90f)) { float single6 = ((tf5.X - p1.X) * (tf5.X - p1.X)) + ((tf5.Y - p1.Y) * (tf5.Y - p1.Y)); if (single6 < single2) { single2 = single6; tf6 = tf5; } } if (EllipseGraph.NearestIntersectionOnArc(ef3, p1, p2, out tf5, 0f, 90f)) { float single7 = ((tf5.X - p1.X) * (tf5.X - p1.X)) + ((tf5.Y - p1.Y) * (tf5.Y - p1.Y)); if (single7 < single2) { single2 = single7; tf6 = tf5; } } } else if (EllipseGraph.NearestIntersectionOnArc(ef3, p1, p2, out tf5, single4, 180f)) { float single8 = ((tf5.X - p1.X) * (tf5.X - p1.X)) + ((tf5.Y - p1.Y) * (tf5.Y - p1.Y)); if (single8 < single2) { single2 = single8; tf6 = tf5; } } if (StrokeGraph.NearestIntersectionOnLine(tf1, tf2, p1, p2, out tf5)) { float single9 = ((tf5.X - p1.X) * (tf5.X - p1.X)) + ((tf5.Y - p1.Y) * (tf5.Y - p1.Y)); if (single9 < single2) { single2 = single9; tf6 = tf5; } } if (StrokeGraph.NearestIntersectionOnLine(tf3, tf4, p1, p2, out tf5)) { float single10 = ((tf5.X - p1.X) * (tf5.X - p1.X)) + ((tf5.Y - p1.Y) * (tf5.Y - p1.Y)); if (single10 < single2) { single2 = single10; tf6 = tf5; } } result = tf6; return(single2 < 1E+21f); }