public struct Box
Represents a 2D axis aligned bounding box.

Constructors

Box

#
public Box(double x0, double x1, double y0, double y1)
Create a new ray box.
x0 (double)First x extreme.
x1 (double)Second x extreme.
y0 (double)First y extreme.
y1 (double)Second y extreme.

Properties

Area

#
public double Area { get; }
Gets the area of this box.

Empty

#
public static Box Empty { get; }
Gets the empty box.

Infinite

#
public static Box Infinite { get; }
Gets the infinite box.

IsEmpty

#
public bool IsEmpty { get; }
Geta whether this box has zero area.

IsInfinite

#
public bool IsInfinite { get; }
Gets whether this box is fully infinite in all directions.

X0

#
public double X0 { get; }
Minimum x.

X1

#
public double X1 { get; }
Maximum x.

Y0

#
public double Y0 { get; }
Minimum y.

Y1

#
public double Y1 { get; }
Maximum y.

Methods

Equals

#
public override bool Equals(object obj)
Indicates whether this instance and a specified object are equal.
obj (object)The object to compare with the current instance.
true if obj and this instance are the same type and represent the same value; otherwise, false.
ValueType.Equals

GetHashCode

#
public override int GetHashCode()
Returns the hash code for this instance.
A 32-bit signed integer that is the hash code for this instance.

Grow

#
public Box Grow(double amount)
Grow a box in all directions. None boxes remain empty.
amount (double)Amount to grow.
Grown box.

Grow

#
public Box Grow(double x0Amount, double x1Amount, double y0Amount, double y1Amount)
Grow a box in all directions. None boxes remain empty.
x0Amount (double)Amount to grow along negative X.
x1Amount (double)Amount to grow along positive X.
y0Amount (double)Amount to grow along negative Y.
y1Amount (double)Amount to grow along positive X.
Grown box.

Intersection

#
public static Box Intersection(params Box[] boxes)
Gets the intersection of a set of boxes. None boxes will be ignored.
boxes (params Box[])Boxes to intersect.
Box containing the space shared amongst all non-empty boxes.

IsCoincident

#
public int IsCoincident(double x, double y)
Gets the coincidence of a point. None boxes are never coincident.
x (double)Point X coordinate.
y (double)Point Y coordinate.
-1 if point is outside, 0 if point is on boundary, +1 if point is on interior.

ToString

#
public override string ToString()
Gets a string representation of this box.

Union

#
public static Box Union(params Box[] boxes)
Get the union of a set of boxes. None boxes will be ignored.
boxes (params Box[])Boxes to union.
Box containing all non-empty boxes.

Operators

OperationResultDescription
Box==BoxboolCompare two boxes for equality. None boxes are always equal to each other.
Box!=BoxboolCompare two boxes for inequality. None boxes are always equal to each other.

Convertors

OperationResultDescription
implicitRectangleFBoxConverter to RectangleF.
implicitBoxRectangleFConverter to RectangleF.