BoundingBox

References
[StructLayout(LayoutKind.Sequential, Pack = 8, Size = 48)] [Serializable] public struct BoundingBox : ICloneable
Represents the value of two points in a bounding box defined by the two extreme corner points.

This box is therefore aligned to the world X, Y and Z axes.

Constructors

BoundingBox

#Since v5.0
public BoundingBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ)
Constructs a bounding box from numeric extremes.
minX (double)Lower extreme for box X size.
minY (double)Lower extreme for box Y size.
minZ (double)Lower extreme for box Z size.
maxX (double)Upper extreme for box X size.
maxY (double)Upper extreme for box Y size.
maxZ (double)Upper extreme for box Z size.

BoundingBox

#Since v6.0
public BoundingBox(IEnumerable<Point3d> points, Transform xform)
Constructs a bounding box from a collection of points.
points (IEnumerable<Point3d>)Points to include in the bounding box.
xform (Transform)Transformation.

BoundingBox

#Since v5.0
public BoundingBox(IEnumerable<Point3d> points)
Constructs a bounding box from a collection of points.
points (IEnumerable<Point3d>)Points to include in the bounding box.

BoundingBox

#ExampleSince v5.0
public BoundingBox(Point3d min, Point3d max)
Constructs a new bounding box from two corner points.
min (Point3d)Point containing all the minimum coordinates.
max (Point3d)Point containing all the maximum coordinates.

Properties

Area

#Since v6.0
public double Area { get; }
Gets the area of this BoundingBox.

Center

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

Diagonal

#Since v5.0
public Vector3d Diagonal { get; }
Gets the diagonal vector of this BoundingBox. The diagonal connects the Min and Max points.

Empty

#Since v5.0
public static BoundingBox Empty { get; }
Gets an [Empty] bounding box. An Empty box is an invalid structure that has negative width.

IsValid

#Since v5.0
public bool IsValid { get; }
Gets a value that indicates whether or not this bounding box is valid. Empty boxes are not valid, and neither are boxes with unset points.

Max

#Since v5.0
public Point3d Max { get; set; }
Gets or sets the point in the maximal corner.

Min

#Since v5.0
public Point3d Min { get; set; }
Gets or sets the point in the minimal corner.

Unset

#Since v5.0
public static BoundingBox Unset { get; }
Gets a bounding box that has Unset coordinates for Min and Max.

Volume

#Since v6.0
public double Volume { get; }
Gets the volume of this BoundingBox.

Methods

ClosestPoint

#Since v5.0
[ConstOperation] public Point3d ClosestPoint(Point3d point, bool includeInterior)
Finds the closest point on or in the bounding box.
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 bounding box.
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 this bounding box contains another bounding box.

The user can choose how to treat bounding boxes with coincident surfaces.

box (BoundingBox)Box to test.
strict (bool)If true, the box needs to be fully on the inside of the bounding box. I.e. coincident boxes will be considered 'outside'.
true if the box is (strictly) on the inside of this BoundingBox.

Contains

#Since v5.0
[ConstOperation] public bool Contains(BoundingBox box)
Determines whether this bounding box contains another bounding box.

This is the same as calling Contains(box,false).

box (BoundingBox)Box to test.
true if the box is on the inside of this bounding box, or is coincident with the surface of it.

Contains

#Since v5.0
[ConstOperation] public bool Contains(Point3d point, bool strict)
Tests a point for BoundingBox inclusion.
point (Point3d)Point to test.
strict (bool)If true, the point needs to be fully on the inside of the BoundingBox. I.e. coincident points will be considered 'outside'.

If 'strict' is affirmative, true if the point is inside this bounding box; false if it is on the surface or outside.

If 'strict' is negative, true if the point is on the surface or on the inside of the bounding box; otherwise false.

Contains

#Since v5.0
[ConstOperation] public bool Contains(Point3d point)
Tests a point for bounding box inclusion. This is the same as calling Contains(point, false)
point (Point3d)Point to test.
true if the point is on the inside of or coincident with this bounding box; otherwise false.

Corner

#Since v5.0
[ConstOperation] public Point3d Corner(bool minX, bool minY, bool minZ)
Gets one of the eight corners of the box.
minX (bool)true for the minimum on the X axis; false for the maximum.
minY (bool)true for the minimum on the Y axis; false for the maximum.
minZ (bool)true for the minimum on the Z axis; false for the maximum.
The requested point.

FurthestPoint

#Since v5.0
[ConstOperation] public Point3d FurthestPoint(Point3d point)
Finds the furthest point on the Box.
point (Point3d)Sample point.
The point on the box that is furthest from the sample point.

GetCorners

#ExampleSince v5.0
[ConstOperation] public Point3d[] GetCorners()
Gets an array filled with the 8 corner points of this box.

See remarks for the return order.

Remarks:

[0] Min.X, Min.Y, Min.Z

[1] Max.X, Min.Y, Min.Z

[2] Max.X, Max.Y, Min.Z

[3] Min.X, Max.Y, Min.Z

[4] Min.X, Min.Y, Max.Z

[5] Max.X, Min.Y, Max.Z

[6] Max.X, Max.Y, Max.Z

[7] Min.X, Max.Y, Max.Z

An array of 8 corners.

GetEdges

#Since v5.0
[ConstOperation] public Line[] GetEdges()
Gets an array of the 12 edges of this box.
If the bounding box IsValid, the 12 edges; otherwise, null.

Inflate

#Since v5.0
public void Inflate(double amount)
Inflates the box with equal amounts in all directions. Inflating with negative amounts may result in decreasing boxes.

Invalid boxes can not 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)
Inflate the box with custom amounts in all directions. Inflating with negative amounts may result in decreasing boxes.

InValid boxes can not 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.

Intersection

#Since v5.0
public static BoundingBox Intersection(BoundingBox a, BoundingBox b)
Computes the intersection of two bounding boxes.
Remarks: The intersection is empty when a and b do not overlap, and when either box is invalid. Invalid boxes are treated as the empty set. Boxes that merely touch do overlap, and produce a valid, degenerate (zero thickness) intersection box.

To test two boxes for overlap without constructing an intersection box, use IsDisjoint(BoundingBox).

a (BoundingBox)A first bounding box.
b (BoundingBox)A second bounding box.
The intersection bounding box, or Unset if the intersection is empty.

IsDegenerate

#ExampleSince v5.0
[ConstOperation] public int IsDegenerate(double tolerance)
Determines whether a bounding box is degenerate (flat) in one or more directions.
tolerance (double)Distances <= tolerance will be considered to be zero. If tolerance is negative (default), then a scale invariant tolerance is used.
0 = box is not degenerate 1 = box is a rectangle (degenerate in one direction). 2 = box is a line (degenerate in two directions). 3 = box is a point (degenerate in three directions) 4 = box is not valid.

IsDisjoint

#Since v9.0
[ConstOperation] public bool IsDisjoint(BoundingBox box, double tolerance)
Determines whether this bounding box and another bounding box are disjoint, that is, whether they do not intersect, allowing a tolerance for the comparison.
Remarks: If either box is invalid, then true is returned.
box (BoundingBox)Box to test.
tolerance (double)Distance tolerance for the comparison.

When tolerance is positive, the boxes are considered to intersect (not disjoint) if the gap between them is less than or equal to tolerance. This is useful as a coarse pre-check when the boxes may be separated by numerical noise but the underlying geometry actually intersects within a working tolerance.

When tolerance is 0.0, the result is the same as IsDisjoint(box).

When tolerance is negative, the boxes must overlap by more than the absolute value of tolerance to be considered not disjoint.

true if this bounding box and box are disjoint.

IsDisjoint

#Since v9.0
[ConstOperation] public bool IsDisjoint(BoundingBox box)
Determines whether this bounding box and another bounding box are disjoint, that is, whether they do not intersect.

This is the same as calling IsDisjoint(box, 0.0).

Remarks: If either box is invalid, then true is returned. Boxes that merely touch are not disjoint.
box (BoundingBox)Box to test.
true if this bounding box and box are disjoint.

MakeValid

#Since v5.0
public bool MakeValid()
Ensures that the box is defined in an increasing fashion along X, Y and Z axes. If the Min or Max points are unset, this function will not change the box.
true if the box was made valid, false if the box could not be made valid.

MaximumDistanceTo

#Since v9.0
public double MaximumDistanceTo(Point3d testPoint)
Finds the largest distance between this bounding box and a test point.
testPoint (Point3d)A point to test.
The maximum distance.

MinimumDistanceTo

#Since v9.0
public double MinimumDistanceTo(Point3d testPoint)
Finds the shortest distance between this bounding box and a test point.
testPoint (Point3d)A point to test.
The minimum distance.

PointAt

#Since v5.0
[ConstOperation] public Point3d PointAt(double tx, double ty, double tz)
Evaluates the bounding box with normalized parameters.

The box has idealized side length of 1x1x1.

tx (double)Normalized (between 0 and 1 is inside the box) parameter along the X direction.
ty (double)Normalized (between 0 and 1 is inside the box) parameter along the Y direction.
tz (double)Normalized (between 0 and 1 is inside the box) parameter along the Z direction.
The point at the {tx, ty, tz} parameters.
Explicit

ICloneable.Clone

#

ToBrep

#ExampleSince v5.0
[ConstOperation] public Brep ToBrep()
Constructs a Brep representation of this bounding box.
If this operation is successful, a Brep representation of this box; otherwise null.

ToString

#
public override string ToString()
Constructs the string representation of this aligned bounding box.
Text.

Transform

#Since v5.0
public bool Transform(Transform xform)
Updates this bounding box to be the smallest axis aligned bounding box that contains the transformed result of its 8 original corner points.
xform (Transform)A transform.
true if this operation is successful; otherwise false.

Union

#Since v5.0
public static BoundingBox Union(BoundingBox a, BoundingBox b)
Returns a new BoundingBox that represents the union of boxes a and b.
Remarks: Invalid boxes are ignored and will not affect the union.
a (BoundingBox)First box to include in union.
b (BoundingBox)Second box to include in union.
The BoundingBox that contains both a and b.

Union

#Since v5.0
public static BoundingBox Union(BoundingBox box, Point3d point)
Returns a new BoundingBox that represents the union of a bounding box and a point.
Remarks: Invalid boxes and points are ignored and will not affect the union.
box (BoundingBox)Box to include in the union.
point (Point3d)Point to include in the union.
The BoundingBox that contains both the box and the point.

Union

#Since v5.0
public void Union(BoundingBox other)
Updates this BoundingBox to represent the union of itself and another box.
Remarks: If either this BoundingBox or the other BoundingBox is InValid, the Valid BoundingBox will be the only one included in the union.
other (BoundingBox)Box to include in this union.

Union

#Since v5.0
public void Union(Point3d point)
Updates this BoundingBox to represent the union of itself and a point.
Remarks: If this bounding box is InValid then the union will be the BoundingBox containing only the point. If the point is InValid, this BoundingBox will remain unchanged.
point (Point3d)Point to include in the union.