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
Constructs a bounding box from numeric extremes.
public BoundingBox(
minX,
Lower extreme for box X size.
minY,
Lower extreme for box Y size.
minZ,
Lower extreme for box Z size.
maxX,
Upper extreme for box X size.
maxY,
Upper extreme for box Y size.
maxZ
Upper extreme for box Z size.
)

BoundingBox

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

BoundingBox

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

BoundingBox

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

Properties

Area

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

Center

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

Diagonal

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

Empty

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

IsValid

#Since v5.0
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.
public bool IsValid { get; }

Max

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

Min

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

Unset

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

Volume

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

Methods

ClosestPoint

#Since v5.0
Finds the closest point on or in the bounding box.
[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 bounding box.
[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 this bounding box contains another bounding box.

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

[ConstOperation] public bool Contains(
box,
Box to test.
strict
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
Determines whether this bounding box contains another bounding box.

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

[ConstOperation] public bool Contains(
box
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
Tests a point for BoundingBox inclusion.
[ConstOperation] public bool Contains(
point,
Point to test.
strict
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
Tests a point for bounding box inclusion. This is the same as calling Contains(point, false)
[ConstOperation] public bool Contains(
point
Point to test.
)
true if the point is on the inside of or coincident with this bounding box; otherwise false.

Corner

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

FurthestPoint

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

GetCorners

#ExampleSince v5.0
Gets an array filled with the 8 corner points of this box.

See remarks for the return order.

[ConstOperation] public Point3d[] GetCorners()
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
Gets an array of the 12 edges of this box.
[ConstOperation] public Line[] GetEdges()
If the bounding box IsValid, the 12 edges; otherwise, null.

Inflate

#Since v5.0
Inflates the box with equal amounts in all directions. Inflating with negative amounts may result in decreasing boxes.

Invalid boxes can not be inflated.

public void Inflate(
amount
Amount (in model units) to inflate this box in all directions.
)

Inflate

#Since v5.0
Inflate the box with custom amounts in all directions. Inflating with negative amounts may result in decreasing boxes.

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

Intersection

#Since v5.0
Computes the intersection of two bounding boxes.
public static BoundingBox Intersection(
a,
A first bounding box.
b
A second bounding box.
)
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).

The intersection bounding box, or Unset if the intersection is empty.

IsDegenerate

#ExampleSince v5.0
Determines whether a bounding box is degenerate (flat) in one or more directions.
[ConstOperation] public int IsDegenerate(
tolerance
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
Determines whether this bounding box and another bounding box are disjoint, that is, whether they do not intersect, allowing a tolerance for the comparison.
[ConstOperation] public bool IsDisjoint(
box,
Box to test.
tolerance
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.

)
Remarks: If either box is invalid, then true is returned.
true if this bounding box and box are disjoint.

IsDisjoint

#Since v9.0
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).

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

MakeValid

#Since v5.0
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.
public bool MakeValid()
true if the box was made valid, false if the box could not be made valid.

MaximumDistanceTo

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

MinimumDistanceTo

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

PointAt

#Since v5.0
Evaluates the bounding box with normalized parameters.

The box has idealized side length of 1x1x1.

[ConstOperation] public Point3d PointAt(
tx,
Normalized (between 0 and 1 is inside the box) parameter along the X direction.
ty,
Normalized (between 0 and 1 is inside the box) parameter along the Y direction.
tz
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
Constructs a Brep representation of this bounding box.
[ConstOperation] public Brep ToBrep()
If this operation is successful, a Brep representation of this box; otherwise null.

ToString

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

Transform

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

Union

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

Union

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

Union

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

Union

#Since v5.0
Updates this BoundingBox to represent the union of itself and a point.
public void Union(
point
Point to include in the union.
)
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.