Generated by DocFX

Class RectangleExtensions

Static class containing Rectangle static helper and extension methods

Inheritance
System.Object
RectangleExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Ladybug
Assembly: ladybug.dll
Syntax
public static class RectangleExtensions

Methods

| Improve this Doc View Source

Contains(Rectangle, Point, Boolean)

Checks if given position lies within the rectangle

Declaration
public static bool Contains(this Rectangle r, Point pos, bool includeAllEdges)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
Microsoft.Xna.Framework.Point pos
System.Boolean includeAllEdges
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Contains(Rectangle, Vector2, Boolean)

Checks if given position lies within the rectangle

Declaration
public static bool Contains(this Rectangle r, Vector2 pos, bool includeAllEdges)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
Microsoft.Xna.Framework.Vector2 pos
System.Boolean includeAllEdges
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Contains(Rectangle, Int32, Int32, Boolean)

Checks if given position lies within the rectangle

Declaration
public static bool Contains(this Rectangle r, int x, int y, bool includeAllEdges)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
System.Int32 x
System.Int32 y
System.Boolean includeAllEdges
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Contains(Rectangle, Single, Single, Boolean)

Checks if given position lies within the rectangle

Declaration
public static bool Contains(this Rectangle r, float x, float y, bool includeAllEdges)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
System.Single x
System.Single y
System.Boolean includeAllEdges
Returns
Type Description
System.Boolean
| Improve this Doc View Source

CopyAtOffset(Rectangle, Vector2)

Get a new copy of Rectangle at given offset

Declaration
public static Rectangle CopyAtOffset(this Rectangle r, Vector2 newPosition)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
Microsoft.Xna.Framework.Vector2 newPosition
Returns
Type Description
Microsoft.Xna.Framework.Rectangle
| Improve this Doc View Source

CopyAtOffset(Rectangle, Int32, Int32)

Get a new copy of Rectangle at given offset

Declaration
public static Rectangle CopyAtOffset(this Rectangle r, int x, int y)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
System.Int32 x
System.Int32 y
Returns
Type Description
Microsoft.Xna.Framework.Rectangle
| Improve this Doc View Source

CopyAtPosition(Rectangle, Vector2, BoxHandle)

Get a new copy of Rectangle at given position

Declaration
public static Rectangle CopyAtPosition(this Rectangle r, Vector2 position, BoxHandle handle = BoxHandle.TopLeft)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
Microsoft.Xna.Framework.Vector2 position
BoxHandle handle
Returns
Type Description
Microsoft.Xna.Framework.Rectangle

New Rectangle of same dimensions at given position

| Improve this Doc View Source

CopyAtPosition(Rectangle, Int32, Int32, BoxHandle)

Get a new copy of Rectangle at given position

Declaration
public static Rectangle CopyAtPosition(this Rectangle r, int x, int y, BoxHandle handle = BoxHandle.TopLeft)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
System.Int32 x
System.Int32 y
BoxHandle handle
Returns
Type Description
Microsoft.Xna.Framework.Rectangle

New Rectangle of same dimensions at given position

| Improve this Doc View Source

GetHandlePosition(Rectangle, BoxHandle)

Gets the Vector2 position of one of this Rectangle's handles

Declaration
public static Vector2 GetHandlePosition(this Rectangle r, BoxHandle handle)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
BoxHandle handle
Returns
Type Description
Microsoft.Xna.Framework.Vector2
| Improve this Doc View Source

PointInBounds(Rectangle, Vector2)

Whether a given Point is within the bounds of this Rectangle

Declaration
public static bool PointInBounds(this Rectangle r, Vector2 position)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
Microsoft.Xna.Framework.Vector2 position
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ToPolygon(Rectangle)

Converts a Rectangle to a Polygon using the rectangle's corners as its vectors

Declaration
public static Polygon ToPolygon(this Rectangle r)
Parameters
Type Name Description
Microsoft.Xna.Framework.Rectangle r
Returns
Type Description
Polygon