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.
Parameters:
| bbox (BoundingBox) | BoundingBox to mimic. |
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.
Parameters:
| basePlane (Plane) | Base plane of bounding box. |
| boundingbox (BoundingBox) | Bounding Box in plane coordinates. |
Initializes a box that contains a generic piece of geometry. This box will be aligned with an arbitrary plane.
Parameters:
| basePlane (Plane) | Base plane for aligned bounding box. |
| geometry (GeometryBase) | Geometry to box. |
Initializes the smallest box that contains a set of points.
Parameters:
| basePlane (Plane) | Orientation of the box. |
| points (IEnumerable<Point3d>) | Points to include, Invalid points will be ignored. |
Initializes a new box from a base Plane and three Intervals.
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.
Finds the closest point on or in the Box. The box should be Valid for this to work.
Parameters:
| point (Point3d) | Sample point. |
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.
Parameters:
| 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. |
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.
Parameters:
| box (BoundingBox) | BoundingBox to test. |
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.
Parameters:
| 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. |
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.
Parameters:
| box (Box) | Box to test. |
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.
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.
Parameters:
| point (Point3d) | Point to test. |
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.
Parameters:
| point (Point3d) | Sample point. |
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.
Parameters:
| amount (double) | Amount (in model units) to inflate this box in all directions. |
Inflates the box by a given offset in each direction. Inflating with negative amounts may result in decreasing boxes. InValid boxes cannot be inflated.
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.
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.
Parameters:
| 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. |
Returns: The point at (x,y,z).
Repositions the origin of the Base plane for this box without affecting the physical dimensions.
Parameters:
| origin (Point3d) | The new base plane origin. |
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.
Parameters:
| xform (Transform) | Transformation matrix to apply to this Box. |
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.
Parameters:
| point (Point3d) | Point to include. |