public bool Contains(Point2D point, double precision) { if (point.X > System.Math.Max(this.start.X, this.end.X) + precision || point.X < System.Math.Min(this.start.X, this.end.X) - precision || (point.Y > System.Math.Max(this.start.Y, this.end.Y) + precision || point.Y < System.Math.Min(this.start.Y, this.end.Y) - precision)) { return(false); } if (Point2D.AreApproxEqual(this.start, this.end, precision)) { return(true); } Vector2D delta = this.GetDelta(); double lengthSquared = delta.GetLengthSquared(); double num1 = precision * precision * lengthSquared; Vector2D u = point - this.start; Vector2D v = new Vector2D(-delta.Y, delta.X); double num2 = Vector2D.DotProduct(u, v); if (num2 * num2 > num1) { return(false); } double num3 = Vector2D.DotProduct(u, delta); if (num3 < 0.0 && num3 * num3 > num1) { return(false); } double num4 = System.Math.Abs(num3); if (num4 > lengthSquared) { double num5 = System.Math.Sqrt(lengthSquared); if (num4 > num5 * (num5 + precision)) { return(false); } } return(true); }