Represents an immutable n-dimensional rectangle.

Constructors

BoxN

#
public BoxN(params BoxN[] boxes)
Create a box from a set of boxes.
boxes (params BoxN[])Boxes.

BoxN

#
public BoxN(params PointN[] points)
Create a box from a set of points.
points (params PointN[])Points.

Properties

Centre

#
public PointN Centre { get; }
Gets the centre of the box.

Description

#
public string Description { get; }
Gets a description of this object type.
Description

Dimensionality

#
public int Dimensionality { get; }
Gets the dimensionality of this object instance.
Dimensionality

IsInfinite

#
public bool IsInfinite { get; }
Gets whether this box is infinite. An infinite box must contain at least one infinite coordinate.

IsSingleton

#
public bool IsSingleton { get; }
Gets whether this box occupies only a single point in space. Infinite and None boxes can never be singletons.

IsUnset

#
public bool IsUnset { get; }
Gets whether this box is unset. A box which contains at least one NaN value is considered unset.

LongestEdge

#
public double LongestEdge { get; }
Gets the length of the shortest edge of this box.

Max

#
public PointN Max { get; }
Gets the maximum point.

Min

#
public PointN Min { get; }
Gets the minimum point.

ShortestEdge

#
public double ShortestEdge { get; }
Gets the length of the shortest edge of this box.

Volume

#
public double Volume { get; }
Gets the volume of this box.

Methods

ClosestPointIn

#
public PointN ClosestPointIn(PointN point)
Gets the point in the volume of this box which is closest to a point.
point (PointN)Point.
Point in this box closest to given point.

ClosestPointOn

#
public PointN ClosestPointOn(PointN point)
Gets the point on the boundary of this box which is closest to a point.
point (PointN)Point.
Point on this box closest to given point.

CompareTo

#
public int CompareTo(BoxN other)
Compare two PointNs for sort order.
other (BoxN)

Contains

#
public bool Contains(BoxN box)
Test whether this box contains another box. Note that two unset boxes are considered to contain each other.
box (BoxN)Box to test for.
True if point is on or in this box.

Contains

#
public bool Contains(PointN point)
Test whether this box contains a point.
point (PointN)Point to test for.
True if point is on or in this box.

CreateInfinite

#
public static BoxN CreateInfinite(int dimensionality)
Create an infinite box.
dimensionality (int)Dimensionality of box.

CreateOrigin

#
public static BoxN CreateOrigin(int dimensionality)
Create an empty box at the origin.
dimensionality (int)Dimensionality of box.
Origin box.

CreateUnit

#
public static BoxN CreateUnit(int dimensionality)
Create a unit box at the origin.
dimensionality (int)Dimensionality of box.
Unit box.

CreateUnset

#
public static BoxN CreateUnset(int dimensionality)
Create an unset box.
dimensionality (int)Dimensionality of box.

Equals

#
public bool Equals(BoxN other)
Compare two BoxNs for equality.
other (BoxN)

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

FurthestPointOn

#
public PointN FurthestPointOn(PointN point)
Gets the point on the boundary of this box which is furthest from another point.
point (PointN)Point.
Point on this box furthest from the given point.

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 BoxN Grow(BoxN box)
Grow this box to include another box.
box (BoxN)Box to include.
Box which includes both this box and the supplied box.

Grow

#
public BoxN Grow(PointN point)
Grow this box to include a new point.
point (PointN)Point to include.
Box which includes both this box and the point.

Intersection

#
public static BoxN Intersection(BoxN a, BoxN b)
Compute the intersection of two boxes.
a (BoxN)First box.
b (BoxN)Second box.
Box which covers the area shared amongst both inputs, or an unset box.

Intersects

#
public bool Intersects(BoxN box)
Test whether this box intersects with another box. Boxes are considered to intersect even if one of them entirely contains the other.
box (BoxN)Other box.
True if both boxes intersect.

PointAt

#
public PointN PointAt(double[] parameters)
Evaluate the box at the specified parameters.
parameters (double[])Normalised parameters to evaluate.
Point at parameters.

RandomPointIn

#
public PointN RandomPointIn(Random random)
Create a random point inside this box.
random (Random)Random generator.
Random point in box.

Split

#
public void Split(int axis, double value, out BoxN left, out BoxN right)
split this box into two sub-boxes.
axis (int)Dimension index to split.
value (double)Value to split at.
left (out BoxN)Input hand box.
right (out BoxN)Right hand box.

ToString

#
public override string ToString()
Returns the fully qualified type name of this instance.

Union

#
public static BoxN Union(BoxN a, BoxN b)
Compute the union of two boxes.
a (BoxN)First box.
b (BoxN)Second box.
Box which covers the area covered by both inputs.