[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
public Box(BoundingBox bbox)
Initializes a new Box that mimics a BoundingBox struct.

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

bbox (BoundingBox)BoundingBox to mimic.

Box

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

Box

#Since v5.0
public Box(Plane basePlane, BoundingBox boundingbox)
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.
Remarks: The box might not contain boundingbox.
basePlane (Plane)Base plane of bounding box.
boundingbox (BoundingBox)Bounding Box in plane coordinates.

Box

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

Box

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

Box

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

Properties

Area

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

BoundingBox

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

Center

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

Empty

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

IsValid

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

Plane

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

Unset

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

Volume

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

X

#Since v5.0
public Interval X { get; set; }
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.

Y

#Since v5.0
public Interval Y { get; set; }
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.

Z

#Since v5.0
public Interval Z { get; set; }
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.

Methods

Clone

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

ClosestPoint

#Since v8.29
[ConstOperation] public Point3d ClosestPoint(Point3d point, bool includeInterior)
Finds the closest point on or in the Box. The box should be Valid for this to work.
point (Point3d)Sample point.
includeInterior (bool)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
[ConstOperation] public Point3d ClosestPoint(Point3d point)
Finds the closest point on or in the Box. The box should be Valid for this to work.
point (Point3d)Sample point.
The point on or in the box that is closest to the sample point.

Contains

#Since v5.0
[ConstOperation] public bool Contains(BoundingBox box, bool strict)
Determines whether a BoundingBox is inside this Box (strict inclusion, if strict is true). Invalid boxes contain nothing. Invalid bounding boxes are never contained.
box (BoundingBox)BoundingBox to test.
strict (bool)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
[ConstOperation] public bool Contains(BoundingBox box)
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.
box (BoundingBox)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
[ConstOperation] public bool Contains(Box box, bool strict)
Determines whether a Box is inside this Box (strict inclusion, if strict is true). Invalid boxes contain nothing. Invalid boxes are never contained.
box (Box)Box to test.
strict (bool)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
[ConstOperation] public bool Contains(Box box)
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.
box (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
[ConstOperation] public bool Contains(Point3d point, bool strict)
Determines whether a point is (strictly, if strict is true) inside this Box. Invalid boxes contain nothing. Invalid points are never contained.
point (Point3d)Point to test.
strict (bool)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
[ConstOperation] public bool Contains(Point3d point)
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.
point (Point3d)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
[ConstOperation] public bool EpsilonEquals(Box other, double epsilon)
Check that all values in Box other are within epsilon of the values in this Box.
other (Box)
epsilon (double)
EpsilonEquals

FurthestPoint

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

GetCorners

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

Inflate

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

Inflate

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

MakeValid

#Since v5.0 Obsolete v9.0
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.
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.
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
[ConstOperation] public Point3d PointAt(double x, double y, double z)
Evaluates the box at the given unitized parameters.

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

x (double)Unitized parameter (between 0 and 1 is inside the box) along box X direction.
y (double)Unitized parameter (between 0 and 1 is inside the box) along box Y direction.
z (double)Unitized parameter (between 0 and 1 is inside the box) along box Z direction.
The point at (x,y,z).

RepositionBasePlane

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

ICloneable.Clone

#Since v9.0

ToBrep

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

ToExtrusion

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

Transform

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

Union

#Since v5.0
public void Union(Point3d point)
Constructs a union between this Box and the given point. This grows the box in directions so it contains the point.
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.
point (Point3d)Point to include.