Enhanced C#
Language of your choice: library documentation
Static Public Member Functions | List of all members
Loyc.Geometry.RectangleExt Class Reference

Contains methods to manipulate rectangles. More...


Source file:

Remarks

Contains methods to manipulate rectangles.

Unfortunately, C# often can't infer the type parameters. Many of these methods must be called with explicit type parameters.

Static Public Member Functions

static bool IsNormal< Rect, T > (this Rect r)
 
static void Normalize< Rect, T > (this Rect r)
 
static Rect Union< Rect, T > (this Rect a, Rect b)
 Computes the union of two normalized rectangles, i.e. a rectangle large enough to cover both original rectangles. More...
 
static Rect Intersect< Rect, T > (this Rect a, Rect b)
 Computes the intersection of two normalized rectangles, i.e. the region covered by both original rectangles. More...
 
static bool ExpandToInclude< Rect, Point, T > (this Rect a, Point b)
 Expands a rectangle's boundaries to include a given point. More...
 
static bool ExpandToInclude< Rect, Point, T > (this Rect a, IEnumerable< Point > bs)
 Expands a rectangle's boundaries to include a series of points. More...
 
static bool Contains< Rect, Point, T > (this Rect a, Point b)
 Determines whether a rectangle contains a given point. More...
 
static bool Contains< Rect, T > (this Rect a, Rect b)
 Determines whether a rectangle fully contains another rectangle. More...
 
static bool Overlaps< Rect, T > (this Rect a, Rect b)
 Determines whether a rectangle overlaps another rectangle. More...
 
static void SetRect< Rect, T > (this Rect r, T x, T y, T width, T height)
 
static void SetRange< Rect, T > (this Rect r, T x1, T y1, T x2, T y2)
 

Member Function Documentation

static bool Loyc.Geometry.RectangleExt.Contains< Rect, Point, T > ( this Rect  a,
Point  b 
)
inlinestatic

Determines whether a rectangle contains a given point.

Returns false if the rectangle is not normalized.

Type Constraints
Point :IPointReader<T> 
Rect :IRectangleBase<T> 
Rect :INewRectangle 
Rect :Rect 
Rect :T 
T :IComparable<T> 
static bool Loyc.Geometry.RectangleExt.Contains< Rect, T > ( this Rect  a,
Rect  b 
)
inlinestatic

Determines whether a rectangle fully contains another rectangle.

May not work correctly if either of the rectangles is not normalized.

Type Constraints
Rect :IRectangleBase<T> 
Rect :INewRectangle 
Rect :Rect 
Rect :T 
T :IComparable<T> 
static bool Loyc.Geometry.RectangleExt.ExpandToInclude< Rect, Point, T > ( this Rect  a,
Point  b 
)
inlinestatic

Expands a rectangle's boundaries to include a given point.

Returns
Returns true if the rectangle changed.
Type Constraints
Point :IPointReader<T> 
Rect :IRectangleBase<T> 
Rect :INewRectangle 
Rect :Rect 
Rect :T 
T :IComparable<T> 
static bool Loyc.Geometry.RectangleExt.ExpandToInclude< Rect, Point, T > ( this Rect  a,
IEnumerable< Point bs 
)
inlinestatic

Expands a rectangle's boundaries to include a series of points.

Returns
Returns true if the rectangle changed.
Type Constraints
Point :IPointReader<T> 
Rect :IRectangleBase<T> 
Rect :INewRectangle 
Rect :Rect 
Rect :T 
T :IComparable<T> 
static Rect Loyc.Geometry.RectangleExt.Intersect< Rect, T > ( this Rect  a,
Rect  b 
)
inlinestatic

Computes the intersection of two normalized rectangles, i.e. the region covered by both original rectangles.

The results may be incorrect if one or both rectangles are not normalized. If the rectangles do not overlap, a non-normalized rectangle is returned.

Type Constraints
Rect :IRectangleBase<T> 
Rect :INewRectangle 
Rect :Rect 
Rect :T 
T :IComparable<T> 
static bool Loyc.Geometry.RectangleExt.Overlaps< Rect, T > ( this Rect  a,
Rect  b 
)
inlinestatic

Determines whether a rectangle overlaps another rectangle.

May not work correctly if either of the rectangles is not normalized.

Type Constraints
Rect :IRectangleBase<T> 
Rect :INewRectangle 
Rect :Rect 
Rect :T 
T :IComparable<T> 
static Rect Loyc.Geometry.RectangleExt.Union< Rect, T > ( this Rect  a,
Rect  b 
)
inlinestatic

Computes the union of two normalized rectangles, i.e. a rectangle large enough to cover both original rectangles.

The results may be incorrect if one or both rectangles are not normalized.

Type Constraints
Rect :IRectangleBase<T> 
Rect :INewRectangle 
Rect :Rect 
Rect :T 
T :IComparable<T>