/// <summary> Returns whether a point is within the (x,y) rectangle formed by the two boundaries. /// If the point lies on the line formed by the boundaries, this determined whether it lies on the /// segment created by the boundaries. /// </summary> static private bool BetweenInclusive(Vector2D point, Vector2D boundary1, Vector2D boundary2) { return(UtilityFunctions.BetweenInclusive(point.X, Math.Min(boundary1.X, boundary2.X), Math.Max(boundary1.X, boundary2.X)) && UtilityFunctions.BetweenInclusive(point.Y, Math.Min(boundary1.Y, boundary2.Y), Math.Max(boundary1.Y, boundary2.Y))); }