Header menu logo Euclid

Box Type

 An immutable 3D Box with any rotation in 3D space.
 Described by an Origin and three Edge vectors.
 Similar to PPlane, however the three vectors are not unitized.
 This implementation guarantees the box to be always valid.
 That means the Min X, Y and Z axes cannot be flipped individually.
 However the length of one of these axes might still be zero.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1

Record fields

Record Field Description

Origin

Full Usage: Origin

Field type: Pnt

The Origin Corner of the Box.

Field type: Pnt

Xaxis

Full Usage: Xaxis

Field type: Vec

The Edge vector representing the X-axis of the Box.

Field type: Vec

Yaxis

Full Usage: Yaxis

Field type: Vec

The Edge vector representing the Y-axis of the Box.

Field type: Vec

Zaxis

Full Usage: Zaxis

Field type: Vec

The Edge vector representing the Z-axis of the Box.

Field type: Vec

Instance members

Instance member Description

this.AreaSq

Full Usage: this.AreaSq

Returns: float
Modifiers: inline

Calculates the squared volume of the Box. by using the squared lengths of the X , Y and Z axis. This is a bit faster than calculating the area and good enough for relative comparisons or sorting by size.

Returns: float

this.AsString

Full Usage: this.AsString

Returns: string

Format Box into string with nice floating point number formatting of X, Y and Z size only. But without type name as in v.ToString()

Returns: string

this.BBox

Full Usage: this.BBox

Returns: BBox

Gets the axis aligned 3D Bounding Box of the Box.

Returns: BBox

this.BackFace

Full Usage: this.BackFace

Returns: Rect3D
 Returns the back face of the Box in Counter-Clockwise order, looking from front.
 Returns Origin at point 3, X-Axis to point 2, Y-Axis to point 7.
 The normal of the Rect3D points into the Box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Rect3D

this.BottomFace

Full Usage: this.BottomFace

Returns: Rect3D
 Returns the bottom face of the Box in Counter-Clockwise order, looking from above.
 Returns Origin at point 0, X-Axis to point 1, Y-Axis to point 3.
 The normal of the Rect3D points into the Box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Rect3D

this.Center

Full Usage: this.Center

Returns: Pnt
Modifiers: inline

The center of the Box.

Returns: Pnt

this.Contains

Full Usage: this.Contains

Parameters:
Returns: bool

Check for point containment in the Box. By doing 6 dot products with the sides of the rectangle. A point exactly on the edge of the Box is considered inside.

p : Pnt
Returns: bool

this.Diagonal

Full Usage: this.Diagonal

Returns: Vec
Modifiers: inline

The diagonal vector of the Box.

Returns: Vec

this.EvaluateAt

Full Usage: this.EvaluateAt

Parameters:
    xParameter : float
    yParameter : float
    zParameter : float

Returns: Pnt
Modifiers: inline
 Evaluate a X, Y and Z parameter of the Box.
  0.0, 0.0, 0.0 returns the Origin.
  1.0, 1.0, 1.0 returns the FarCorner.
xParameter : float
yParameter : float
zParameter : float
Returns: Pnt

this.FarCorner

Full Usage: this.FarCorner

Returns: Pnt
Modifiers: inline

The corner diagonally opposite of corner from Origin.

Returns: Pnt

this.FrontFace

Full Usage: this.FrontFace

Returns: Rect3D
 Returns the front face of the Box in Counter-Clockwise order, looking from front.
 Returns Origin at point 0, X-Axis to point 1, Y-Axis to point 4.
 The normal of the Rect3D points away from the Box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Rect3D

this.LeftFace

Full Usage: this.LeftFace

Returns: Rect3D
 Returns the left face of the Box in Counter-Clockwise order, looking from right.
 Returns Origin at point 0, X-Axis to point 3, Y-Axis to point 4.
 The normal of the Rect3D points into the Box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Rect3D

this.Plane

Full Usage: this.Plane

Returns: PPlane
Modifiers: inline

Gets the Plane that this box is based on.

Returns: PPlane

this.Points

Full Usage: this.Points

Returns: Pnt[]
 Returns the bottom corners of the Box in Counter-Clockwise order, starting at Origin.
 Then the top corners staring above Origin. Returns an array of 8 Points.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Pnt[]

this.Pt0

Full Usage: this.Pt0

Returns: Pnt
Modifiers: inline
 Returns point 0 of the box, same box.Origin.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Pnt

this.Pt1

Full Usage: this.Pt1

Returns: Pnt
Modifiers: inline
 Returns point 1 of the box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Pnt

this.Pt2

Full Usage: this.Pt2

Returns: Pnt
Modifiers: inline
 Returns point 2 of the box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Pnt

this.Pt3

Full Usage: this.Pt3

Returns: Pnt
Modifiers: inline
 Returns point 3 of the box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Pnt

this.Pt4

Full Usage: this.Pt4

Returns: Pnt
Modifiers: inline
 Returns point 4 of the box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Pnt

this.Pt5

Full Usage: this.Pt5

Returns: Pnt
Modifiers: inline
 Returns point 5 of the box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Pnt

this.Pt6

Full Usage: this.Pt6

Returns: Pnt
Modifiers: inline
 Returns point 6 of the box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Pnt

this.Pt7

Full Usage: this.Pt7

Returns: Pnt
Modifiers: inline
 Returns point 7 of the box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Pnt

this.RightFace

Full Usage: this.RightFace

Returns: Rect3D
 Returns the right face of the Box in Counter-Clockwise order, looking from right.
 Returns Origin at point 1, X-Axis to point 2, Y-Axis to point 5.
 The normal of the Rect3D points away from the Box.

   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Rect3D

this.SizeX

Full Usage: this.SizeX

Returns: float
Modifiers: inline

The size in X direction.

Returns: float

this.SizeXSq

Full Usage: this.SizeXSq

Returns: float
Modifiers: inline

The size in X direction squared.

Returns: float

this.SizeY

Full Usage: this.SizeY

Returns: float
Modifiers: inline

The size in Y direction.

Returns: float

this.SizeYSq

Full Usage: this.SizeYSq

Returns: float
Modifiers: inline

The size in Y direction squared.

Returns: float

this.SizeZ

Full Usage: this.SizeZ

Returns: float
Modifiers: inline

The size in Z direction.

Returns: float

this.SizeZSq

Full Usage: this.SizeZSq

Returns: float
Modifiers: inline

The size in Z direction squared.

Returns: float

this.TopFace

Full Usage: this.TopFace

Returns: Rect3D
 Returns the top face of the Box in Counter-Clockwise order, looking from above.
 Returns Origin at point 4, X-Axis to point 5, Y-Axis to point 7.
 The normal of the Rect3D points away from the Box.
   local        local
   Z-Axis       Y-Axis
   ^           /
   |   7      /        6
   |   +---------------+
   |  /|    /         /|
   | / |   /         / |
 4 |/  |  /       5 /  |
   +---------------+   |
   |   |/          |   |
   |   +-----------|---+
   |  / 3          |  / 2
   | /             | /
   |/              |/     local
   +---------------+----> X-Axis
   0               1
Returns: Rect3D

this.Volume

Full Usage: this.Volume

Returns: float
Modifiers: inline

Calculates the volume of the Box.

Returns: float

this.XaxisUnit

Full Usage: this.XaxisUnit

Returns: Vec
Modifiers: inline

Creates a unitized version of the local X-Axis.

Returns: Vec

this.YaxisUnit

Full Usage: this.YaxisUnit

Returns: Vec
Modifiers: inline

Creates a unitized version of the local Y-Axis.

Returns: Vec

this.ZaxisUnit

Full Usage: this.ZaxisUnit

Returns: Vec
Modifiers: inline

Creates a unitized version of the local Z-Axis.

Returns: Vec

Static members

Static member Description

Box.contains p b

Full Usage: Box.contains p b

Parameters:
Returns: bool
Modifiers: inline

Check for point containment in the Box. By doing 6 dot products with the sides of the rectangle. A point exactly on the edge of the Box is considered inside.

p : Pnt
b : Box
Returns: bool

Box.createFromBoundingBox b

Full Usage: Box.createFromBoundingBox b

Parameters:
Returns: Box

Creates a 3D box from a 3D a bounding box.

b : BBox
Returns: Box

Box.createFromDirsAndPoints dirX dirY pts

Full Usage: Box.createFromDirsAndPoints dirX dirY pts

Parameters:
Returns: Box

Finds the oriented bounding box in 3D of a set of points. The orientation of the X-axis is defined by the dirX vector. The orientation of the Y-axis is defined by the dirY vector.

dirX : Vec
dirY : Vec
pts : IList<Pnt>
Returns: Box

Box.createFromPlane (pl, x, y, z)

Full Usage: Box.createFromPlane (pl, x, y, z)

Parameters:
    pl : PPlane
    x : float
    y : float
    z : float

Returns: Box

Creates a 3D box from PPlane and x, y and Z size.

pl : PPlane
x : float
y : float
z : float
Returns: Box

Box.createFromPlaneAndPoints pl pts

Full Usage: Box.createFromPlaneAndPoints pl pts

Parameters:
Returns: Box

Finds the oriented bounding box in 3D of a set of points. The orientation of the X-axis is defined by the dirX vector. The orientation of the Y-axis is defined by the dirY vector.

pl : PPlane
pts : IList<Pnt>
Returns: Box

Box.createFromRect2D (r, zLow, zHigh)

Full Usage: Box.createFromRect2D (r, zLow, zHigh)

Parameters:
    r : Rect2D
    zLow : float
    zHigh : float

Returns: Box

Creates a 3D box from a 2D rectangle and Z lower and upper position.

r : Rect2D
zLow : float
zHigh : float
Returns: Box

Box.createFromRect3D (r, zLow, zHigh)

Full Usage: Box.createFromRect3D (r, zLow, zHigh)

Parameters:
    r : Rect3D
    zLow : float
    zHigh : float

Returns: Box

Creates a 3D box from a 3D rectangle and Z lower and upper position.

r : Rect3D
zLow : float
zHigh : float
Returns: Box

Box.equals tol a b

Full Usage: Box.equals tol a b

Parameters:
Returns: bool

Checks if two 3D-boxes are equal within tolerance. Does not recognize congruent boxes with different rotation as equal. Use a tolerance of 0.0 to check for an exact match.

tol : float
a : Box
b : Box
Returns: bool

Box.expand dist b

Full Usage: Box.expand dist b

Parameters:
    dist : float
    b : Box

Returns: Box

Returns Box expanded by distance on all six sides. Does check for underflow if distance is negative and raises EuclidException.

dist : float
b : Box
Returns: Box

Box.expandXYZ distX distY distZ b

Full Usage: Box.expandXYZ distX distY distZ b

Parameters:
    distX : float
    distY : float
    distZ : float
    b : Box

Returns: Box

Returns Box expanded by respective distances on all six sides. Does check for overflow if distance is negative and fails. distX, distY and distZ are for X, Y and Z-axis respectively.

distX : float
distY : float
distZ : float
b : Box
Returns: Box

Box.move v b

Full Usage: Box.move v b

Parameters:
Returns: Box

Creates a 3D box moved by a vector.

v : Vec
b : Box
Returns: Box

Box.notEquals tol a b

Full Usage: Box.notEquals tol a b

Parameters:
Returns: bool

Check if two 3D-boxes are not equal within a given tolerance. Use a tolerance of 0.0 to check if the two 3D-boxes are not exactly equal.

tol : float
a : Box
b : Box
Returns: bool

Box.transform m b

Full Usage: Box.transform m b

Parameters:
Returns: Box

Transform the Box by the given RigidMatrix. The returned Box is guaranteed to have still orthogonal vectors.

m : RigidMatrix
b : Box
Returns: Box

Box.translateX distX b

Full Usage: Box.translateX distX b

Parameters:
    distX : float
    b : Box

Returns: Box

Creates a 3D box translated along the local X-axis of the Box.

distX : float
b : Box
Returns: Box

Box.translateY distY b

Full Usage: Box.translateY distY b

Parameters:
    distY : float
    b : Box

Returns: Box

Creates a 3D box translated along the local Y-axis of the Box.

distY : float
b : Box
Returns: Box

Box.translateZ distZ b

Full Usage: Box.translateZ distZ b

Parameters:
    distZ : float
    b : Box

Returns: Box

Creates a 3D box translated along the local Z-axis of the Box.

distZ : float
b : Box
Returns: Box

Type something to start searching.