/// <summary> /// Split Rectangle /// </summary> /// <param name="r"></param> /// <param name="Left"></param> /// <param name="Right"></param> /// <param name="x"></param> public static void SplitVertical(this RectangleF r, out RectangleF Left, out RectangleF Right, float? x = null) { float xs = x ?? ((r.Left + r.Right) / 2.0f); Left = RectangleFrom2Points(r.TopLeft(), new PointF(xs, r.Bottom)); Right = RectangleFrom2Points(new PointF(xs, r.Top), r.BottomRight()); }
/// <summary> /// Split a Rectangle /// </summary> /// <param name="r">Original Rectangle</param> /// <param name="Left">Out Left Rectangle</param> /// <param name="Right">Out Right Rectangle</param> /// <param name="x">Cut Point (Split center if null)</param> public static void SplitVertical(this Rectangle r, out Rectangle Left, out Rectangle Right, int? x = null) { int xs = x ?? ((r.Left + r.Right) / 2); Left = RectangleFrom2Points(r.TopLeft(), new Point(xs, r.Bottom)); Right = RectangleFrom2Points(new Point(xs, r.Top), r.BottomRight()); }
/// <summary> /// Split Rectangle /// </summary> /// <param name="r"></param> /// <param name="Up"></param> /// <param name="Down"></param> /// <param name="y"></param> public static void SplitHorizontal(this RectangleF r, out RectangleF Up, out RectangleF Down, float? y = null) { float ys = y ?? ((r.Bottom + r.Top) / 2.0f); Up = RectangleFrom2Points(r.TopLeft(), new PointF(r.Right, ys)); Down = RectangleFrom2Points(new PointF(r.Left, ys), r.BottomRight()); }
public static Line BottomLine(this Rectangle rect) { return new Line(rect.BottomLeft(), rect.BottomRight()); }
/// <summary> /// Split a Rectangle /// </summary> /// <param name="r">Original Rectangle</param> /// <param name="Up">Out Up Rectangle</param> /// <param name="Down">Out Down Rectangle</param> /// <param name="y">Cut Point (Split center if null)</param> public static void SplitHorizontal(this Rectangle r, out Rectangle Up, out Rectangle Down, int? y = null) { int ys = y ?? ((r.Bottom + r.Top) / 2); Up = RectangleFrom2Points(r.TopLeft(), new Point(r.Right, ys)); Down = RectangleFrom2Points(new Point(r.Left, ys), r.BottomRight()); }
/// <summary> /// Converts this envelope into a linear ring. /// </summary> /// <param name="self">The IEnvelope to use with this method</param> /// <returns>A Linear ring describing the border of this envelope.</returns> public static ILinearRing ToLinearRing(this IEnvelope self) { // Holes are counter clockwise, so this should create // a clockwise linear ring. CoordinateListSequence coords = new CoordinateListSequence(); coords.Add(self.TopLeft()); coords.Add(self.TopRight()); coords.Add(self.BottomRight()); coords.Add(self.BottomLeft()); coords.Add(self.TopLeft()); // close the polygon return new LinearRing(coords); }
public static Line RightLine(this Rectangle rect) { return new Line(rect.TopRight(), rect.BottomRight()); }
/// <summary> /// Gets an ILineSegment from the top right corner to the bottom right corner /// </summary> /// <param name="self">The IEnvelope to use with this method</param> public static ILineSegment BottomBorder(this IEnvelope self) { return new LineSegment(self.BottomRight(), self.BottomLeft()); }
/// <summary> /// Gets an ILineSegment from the bottom right corner to the bottom left corner /// </summary> /// <param name="self">The IEnvelope to use with this method</param> public static ILineSegment RightBorder(this IEnvelope self) { if(self == null)return null; return new LineSegment(self.TopRight(), self.BottomRight()); }
public static Rect BottomRight(this Rect r, Vector2 v) { return r.BottomRight(v.x, v.y); }
public static Rect BottomRight(this Rect r, float f) { return r.BottomRight(f, f); }
public static Rect LowerRight(this Rect r, float width, float height) { return r.BottomRight(width, height); }
public static Rect LowerRight(this Rect r, Vector2 v) { return r.BottomRight(v); }
public static Vector2 LowerRight(this Rect r) { return r.BottomRight(); }