Box
References[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
Initializes a new Box that mimics a BoundingBox struct.
The orientation plane of the Box is coincident with the World XY plane.
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()
Remarks: The box might not contain boundingbox.
Initializes a box that contains a generic piece of geometry. This box will be aligned with an arbitrary plane.
public Box()
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.
Properties
Gets the total surface area of this box, or RhinoMath.UnsetValue for an invalid box.
Gets the world axis aligned Bounding box for this oriented box.
Empty Box. Empty boxes are considered to be invalid.
Gets the validity of this Box. Boxes are invalid when the base plane or any of the dimension intervals are invalid or decreasing.
Gets a Box whose base plane and axis dimensions are all Unset.
Gets the total volume of this box, or RhinoMath.UnsetValue for an invalid box.
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.
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.
Methods
Returns a deep copy of this instance.
Returns: A plane with the same values as this item.
Finds the closest point on or in the Box. The box should be Valid for this to work.
Returns: The point on or in the box that is closest to the sample point.
Finds the closest point on or in the Box. The box should be Valid for this to work.
Returns: The point on or in the box that is closest to the sample point.
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.
Returns: true if the box is (strictly, if strict is true) inside this Box. false if this Box or the BoundingBox are invalid.
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.
Returns: true if all corners of the BoundingBox are non-strictly inside this Box. false if this Box or the BoundingBox are invalid.
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.
Returns: true if the box is (strictly) on the inside of this Box. false if this Box or the tested Box are invalid.
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.
Returns: true if all corners of the Box are non-strictly inside this Box. false if this Box or the tested Box are invalid.
Determines whether a point is (strictly, if strict is true) inside this Box. Invalid boxes contain nothing. Invalid points are never contained.
Returns: true if the point is (strictly, if strict is true) inside this Box. false if this Box or the Point are invalid.
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.
Returns: true if the point is in the inside or on the boundary of this Box. false if this Box or the Point are invalid.
Check that all values in Box other are within epsilon of the values in this Box.
Implements: EpsilonEquals
Finds the furthest point on the boundary of this Box. The Box should be Valid for this to work properly.
Returns: The point on boundary of the the box that is furthest from the sample point.
Gets an array of the 8 corner points of this box, or an empty array if this box is not valid.
Returns: An array of 0 or 8 corners.
Inflates the box by a given offset in each direction. Inflating with negative amounts may result in decreasing boxes. InValid boxes cannot be inflated.
Inflates the box by a given offset in each direction. Inflating with negative amounts may result in decreasing boxes. InValid boxes cannot be inflated.
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.
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.
Returns: true if the box was made valid, or if it was valid to begin with. false if the box remains unchanged.
Evaluates the box at the given unitized parameters.
The box is parametrized with a side length of 1x1x1.
Returns: The point at (x,y,z).
Repositions the origin of the Base plane for this box without affecting the physical dimensions.
Constructs a brep representation of this box.
Returns: A Brep representation of this box or null.
Constructs an extrusion representation of this box.
Returns: An Extrusion representation of this box or null.
Transforms this Box using a Transformation matrix. If the Transform is not a Similarity, the dimensions of the resulting box cannot be trusted.
Returns: true if the Box was successfully transformed, false otherwise.
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.