/// <summary> /// Buffers an extent by the provided amount. /// </summary> /// <param name="extentIn">The extent to buffer.</param> /// <param name="amount">The amount to buffer the extent by.</param> /// <returns>A new extent representing the buffer.</returns> public static ILucidExtent Buffer(ILucidExtent extentIn, double amount) { return(new LucidExtent() { XMax = extentIn.XMax += amount, XMin = extentIn.XMin -= amount, YMax = extentIn.YMax += amount, YMin = extentIn.YMin -= amount }); }
public static bool Intersects(IPoint point, ILucidExtent extent) { if (point.X < extent.XMin) { return(false); } if (point.X > extent.XMax) { return(false); } if (point.Y < extent.YMin) { return(false); } if (point.Y > extent.YMax) { return(false); } return(true); }
public static bool Intersects(ILucidExtent first, ILucidExtent second) { if (first.XMax < second.XMin) { return(false); } if (first.XMin > second.XMax) { return(false); } if (first.YMax < second.YMin) { return(false); } if (first.YMin > second.YMax) { return(false); } return(true); }
public static IEnumerable <ILucidExtent> SubdivideExtent(ILucidExtent extent, int width, int height) { var extentWidth = Math.Ceiling(extent.Width / width); var extentHeight = Math.Ceiling(extent.Height / height); for (int c = 0; c < width; c++) { for (var r = 0; r < height; r++) { var windowX = extent.XMin + (c * extentWidth); var windowY = extent.YMin + (r * extentHeight); yield return(new LucidExtent() { XMax = windowX + extentWidth, XMin = windowX, YMax = windowY + extentHeight, YMin = windowY }); } } }