[StructLayout(LayoutKind.Sequential, Pack = 8, Size = 176)] [Serializable] public struct Box : IEpsilonComparable<Box>, ICloneable
Represents the value of a plane and three intervals in an orthogonal, oriented box that is not necessarily parallel to the world Y, X, Z axes.

Constructors

Box

#Since v5.0
Initializes a new Box that mimics a BoundingBox struct.

The orientation plane of the Box is coincident with the World XY plane.

public Box(
bbox
BoundingBox to mimic.
)

Box

#Since v7.0
Copy constructor.
public Box(
Box
other
The source box.
)

Box

#Since v5.0
Initializes a box from a base plane and a world-aligned bounding box. The box will use basePlane for its Plane, and the X, Y, and Z intervals of boundingbox as its X, Y, and Z intervals.
public Box(
basePlane,
Base plane of bounding box.
boundingbox
Bounding Box in plane coordinates.
)
Remarks: The box might not contain boundingbox.

Box

#Since v5.0
Initializes a box that contains a generic piece of geometry. This box will be aligned with an arbitrary plane.
public Box(
basePlane,
Base plane for aligned bounding box.
geometry
Geometry to box.
)

Box

#Since v5.0
Initializes the smallest box that contains a set of points.
public Box(
basePlane,
Orientation of the box.
points
Points to include, Invalid points will be ignored.
)

Box

#Since v5.0
Initializes a new box from a base Plane and three Intervals.
public Box(
basePlane,
Orientation plane of the box.
xSize,
Dimensions along the base plane X-Axis.
ySize,
Dimensions along the base plane Y-Axis.
zSize
Dimensions along the base plane Z-Axis.
)

Properties

Area

#Since v5.0
Gets the total surface area of this box, or RhinoMath.UnsetValue for an invalid box.
public double Area { get; }

BoundingBox

#Since v5.0
Gets the world axis aligned Bounding box for this oriented box.
public BoundingBox BoundingBox { get; }

Center

#Since v5.0
Gets the point that is in the center of the box.
public Point3d Center { get; }

Empty

#Since v5.0
Empty Box. Empty boxes are considered to be invalid.
public static Box Empty { get; }

IsValid

#Since v5.0
Gets the validity of this Box. Boxes are invalid when the base plane or any of the dimension intervals are invalid or decreasing.
public bool IsValid { get; }

Plane

#Since v5.0
Gets or sets the orientation plane for this Box.
public Plane Plane { get; set; }

Unset

#Since v5.0
Gets a Box whose base plane and axis dimensions are all Unset.
public static Box Unset { get; }

Volume

#Since v5.0
Gets the total volume of this box, or RhinoMath.UnsetValue for an invalid box.
public double Volume { get; }

X

#Since v5.0
Gets or sets the Interval that describes the dimension of the Box along the orientation plane X-Axis. Otherwise known as the Width of the Box.
public Interval X { get; set; }

Y

#Since v5.0
Gets or sets the Interval that describes the dimension of the Box along the orientation plane Y-Axis. Otherwise known as the Depth of the Box.
public Interval Y { get; set; }

Z

#Since v5.0
Gets or sets the Interval that describes the dimension of the Box along the orientation plane Z-Axis. Otherwise known as the Height of the Box.
public Interval Z { get; set; }

Methods

Clone

#Since v9.0
Returns a deep copy of this instance.
public Box Clone()
A plane with the same values as this item.

ClosestPoint

#Since v8.29
Finds the closest point on or in the Box. The box should be Valid for this to work.
[ConstOperation] public Point3d ClosestPoint(
point,
Sample point.
includeInterior
If false, the point is projected onto the boundary faces only, otherwise the interior of the box is also taken into consideration.
)
The point on or in the box that is closest to the sample point.

ClosestPoint

#Since v5.0
Finds the closest point on or in the Box. The box should be Valid for this to work.
[ConstOperation] public Point3d ClosestPoint(
point
Sample point.
)
The point on or in the box that is closest to the sample point.

Contains

#Since v5.0
Determines whether a BoundingBox is inside this Box (strict inclusion, if strict is true). Invalid boxes contain nothing. Invalid bounding boxes are never contained.
[ConstOperation] public bool Contains(
box,
BoundingBox to test.
strict
If true, the BoundingBox needs to be strictly inside this Box, i.e. all corners of the BoundingBox are strictly inside this Box. If false, the BoundingBox can be touching this Box's boundary, i.e. all corners of the BoundingBox are non-strictly inside this Box.
)
true if the box is (strictly, if strict is true) inside this Box. false if this Box or the BoundingBox are invalid.

Contains

#Since v5.0
Determines whether a BoundingBox is inside this Box, including its boundary. This is the same as calling Contains(box,false). Invalid boxes contain nothing. Invalid bounding boxes are never contained.
[ConstOperation] public bool Contains(
box
BoundingBox to test.
)
true if all corners of the BoundingBox are non-strictly inside this Box. false if this Box or the BoundingBox are invalid.

Contains

#Since v5.0
Determines whether a Box is inside this Box (strict inclusion, if strict is true). Invalid boxes contain nothing. Invalid boxes are never contained.
[ConstOperation] public bool Contains(
box,
Box to test.
strict
If true, the tested Box needs to be strictly inside this Box, i.e. all corners of the BoundingBox are strictly inside this Box. If false, the tested Box can be touching this Box's boundary, i.e. all corners of the BoundingBox are non-strictly inside this Box.
)
true if the box is (strictly) on the inside of this Box. false if this Box or the tested Box are invalid.

Contains

#Since v5.0
Determines whether a Box is inside this Box, including its boundary. This is the same as calling Contains(box,false). Invalid boxes contain nothing. Invalid boxes are never contained.
[ConstOperation] public bool Contains(
box
Box to test.
)
true if all corners of the Box are non-strictly inside this Box. false if this Box or the tested Box are invalid.

Contains

#Since v5.0
Determines whether a point is (strictly, if strict is true) inside this Box. Invalid boxes contain nothing. Invalid points are never contained.
[ConstOperation] public bool Contains(
point,
Point to test.
strict
If true, the point needs to be strictly inside this Box. I.e. points on the boundary of this Box will be considered 'outside'.
)
true if the point is (strictly, if strict is true) inside this Box. false if this Box or the Point are invalid.

Contains

#Since v5.0
Determines whether a point is inside this Box, including its boundary. This is the same as calling Contains(point,false). Invalid boxes contain nothing. Invalid points are never contained.
[ConstOperation] public bool Contains(
point
Point to test.
)
true if the point is in the inside or on the boundary of this Box. false if this Box or the Point are invalid.

EpsilonEquals

#Since v5.4
Check that all values in Box other are within epsilon of the values in this Box.
[ConstOperation] public bool EpsilonEquals(
other,
epsilon
)
EpsilonEquals

FurthestPoint

#Since v5.0
Finds the furthest point on the boundary of this Box. The Box should be Valid for this to work properly.
[ConstOperation] public Point3d FurthestPoint(
point
Sample point.
)
The point on boundary of the the box that is furthest from the sample point.

GetCorners

#Since v5.0
Gets an array of the 8 corner points of this box, or an empty array if this box is not valid.
[ConstOperation] public Point3d[] GetCorners()
An array of 0 or 8 corners.

Inflate

#Since v5.0
Inflates the box by a given offset in each direction. Inflating with negative amounts may result in decreasing boxes. InValid boxes cannot be inflated.
public void Inflate(
amount
Amount (in model units) to inflate this box in all directions.
)

Inflate

#Since v5.0
Inflates the box by a given offset in each direction. Inflating with negative amounts may result in decreasing boxes. InValid boxes cannot be inflated.
public void Inflate(
xAmount,
Amount (in model units) to inflate this box in the x direction.
yAmount,
Amount (in model units) to inflate this box in the y direction.
zAmount
Amount (in model units) to inflate this box in the z direction.
)

MakeValid

#Since v5.0 Obsolete v9.0
DO NOT USE THIS FUNCTION If some of the box's values (Plane origin or axis, intervals bounds) are unset, do nothing. Else, make the Box valid by reversing the non-increasing intervals of this box. This is almost never what you want because it only makes Empty boxes not empty and with non-zero length.
public bool MakeValid()
obsoleteThis method is misguided and only turns empty boxes (which are invalid by design) into valid non-empty boxes. If you expect your code to create boxes with incorrectly non-increasing intervals that need to be reversed, use m_dx.MakeIncreasing(), etc. instead.
true if the box was made valid, or if it was valid to begin with. false if the box remains unchanged.

PointAt

#Since v5.0
Evaluates the box at the given unitized parameters.

The box is parametrized with a side length of 1x1x1.

[ConstOperation] public Point3d PointAt(
x,
Unitized parameter (between 0 and 1 is inside the box) along box X direction.
y,
Unitized parameter (between 0 and 1 is inside the box) along box Y direction.
z
Unitized parameter (between 0 and 1 is inside the box) along box Z direction.
)
The point at (x,y,z).

RepositionBasePlane

#Since v5.0
Repositions the origin of the Base plane for this box without affecting the physical dimensions.
public void RepositionBasePlane(
origin
The new base plane origin.
)
Explicit

ICloneable.Clone

#Since v9.0

ToBrep

#Since v5.0
Constructs a brep representation of this box.
[ConstOperation] public Brep ToBrep()
A Brep representation of this box or null.

ToExtrusion

#Since v6.0
Constructs an extrusion representation of this box.
[ConstOperation] public Extrusion ToExtrusion()
An Extrusion representation of this box or null.

Transform

#Since v5.0
Transforms this Box using a Transformation matrix. If the Transform is not a Similarity, the dimensions of the resulting box cannot be trusted.
public bool Transform(
Transform
xform
Transformation matrix to apply to this Box.
)
true if the Box was successfully transformed, false otherwise.

Union

#Since v5.0
Constructs a union between this Box and the given point. This grows the box in directions so it contains the point.
public void Union(
point
Point to include.
)
Remarks: If this box is invalid, it becomes the box containing only the point, with the same orientation or the WorldXY's orientation if the orientation was invalid. If point is invalid or can't be projected, this box is unchanged.