Box Type
A struct of 9 floats representing an immutable 3D box with any rotation in 3D space. Described by z, y and z of the Origin and x, y and z for each of the 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
|
Full Usage:
OriginX
Field type: float
|
The X coordinate of the Origin Corner of the Box.
|
Full Usage:
OriginY
Field type: float
|
The Y coordinate of the Origin Corner of the Box.
|
Full Usage:
OriginZ
Field type: float
|
The Z coordinate of the Origin Corner of the Box.
|
Full Usage:
XaxisX
Field type: float
|
The X component of the edge vector representing the X-axis of the Box.
|
Full Usage:
XaxisY
Field type: float
|
The Y component of the edge vector representing the X-axis of the Box.
|
Full Usage:
XaxisZ
Field type: float
|
The Z component of the edge vector representing the X-axis of the Box.
|
Full Usage:
YaxisX
Field type: float
|
The X component of the edge vector representing the Y-axis of the Box.
|
Full Usage:
YaxisY
Field type: float
|
The Y component of the edge vector representing the Y-axis of the Box.
|
Full Usage:
YaxisZ
Field type: float
|
The Z component of the edge vector representing the Y-axis of the Box.
|
Full Usage:
ZaxisX
Field type: float
|
The X component of the edge vector representing the Z-axis of the Box.
|
Full Usage:
ZaxisY
Field type: float
|
The Y component of the edge vector representing the Z-axis of the Box.
|
Full Usage:
ZaxisZ
Field type: float
|
The Z component of the edge vector representing the Z-axis of the Box.
|
Instance members
| Instance member |
Description
|
Full Usage:
this.AreaOfBiggestFace
Returns: float
|
Returns the Area of the biggest face of the box. This is the biggest of the three faces X*Y, X*Z and Y*Z.
|
Full Usage:
this.AreaOfSmallestFace
Returns: float
|
Returns the Area of the smallest face of the box. This is the smallest of the three faces X*Y, X*Z and Y*Z.
|
Full Usage:
this.AsFSharpCode
Returns: string
|
Format box into an F# code string that can be used to recreate the box.
|
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 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.
|
|
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.
|
|
The center of the Box.
|
|
Check for point containment in the Box. By doing six dot products with the box axes to test its six faces. A point exactly on the edge of the box is considered inside.
|
Full Usage:
this.ContainsXYZ
Parameters:
float
y : float
z : float
Returns: bool
|
Check for point containment in the Box. By doing six dot products with the box axes to test its six faces. A point exactly on the edge of the box is considered inside.
|
Full Usage:
this.CountZeroSides
Returns: int
Modifiers: inline |
Counts the amount of sides that are smaller than the zeroLength tolerance. This is 0, 1, 2 or 3.
|
|
The diagonal vector of the Box.
|
|
Returns the X-aligned edge from point 0 to 1.
|
|
Returns the Y-aligned edge from point 0 to 3.
|
|
Returns the Z-aligned edge from point 0 to 4.
|
|
Returns the Y-aligned edge from point 1 to 2.
|
|
Returns the Z-aligned edge from point 1 to 5.
|
|
Returns the Z-aligned edge from point 2 to 6.
|
|
Returns the X-aligned edge from point 3 to 2.
|
|
Returns the Z-aligned edge from point 3 to 7.
|
|
Returns the X-aligned edge from point 4 to 5.
|
|
Returns the Y-aligned edge from point 4 to 7.
|
|
Returns the Y-aligned edge from point 5 to 6.
|
|
Returns the X-aligned edge from point 7 to 6.
|
|
Returns the 12 edges of this box as an array of 12 Lines. Pairs in this order: 0-1, 1-2, 3-2, 0-3, 0-4, 1-5, 2-6, 3-7, 4-5, 5-6, 7-6, 4-7
|
Full Usage:
this.EvaluateAt
Parameters:
float
yParameter : float
zParameter : float
Returns: Pnt
Modifiers: inline |
Evaluate an 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.
|
|
Returns the six faces of the box. The normals of the Rect3Ds are oriented with the X-axis, Y-axis, or Z-axis. The order of the Rect3D is: BottomFace, FrontFace, RightFace, BackFace, LeftFace, TopFace.
|
|
The corner diagonally opposite of corner from Origin.
|
|
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.
|
|
Returns the edge of the box at the specified index. The order of the edges is: 0-1, 1-2, 3-2, 0-3, 0-4, 1-5, 2-6, 3-7, 4-5, 5-6, 7-6, 4-7
|
Full Usage:
this.GetFace
Parameters:
int
-
The index of the face to retrieve. Valid range is 0 to 5.
Returns: Rect3D
The Rect3D representing the specified face of the Box.
|
Returns the face of the box at the specified index. The order of the faces is: BottomFace, FrontFace, RightFace, BackFace, LeftFace, TopFace.
|
|
Returns the point of the box at the specified index. The order of the points is: Pt0, Pt1, Pt2, Pt3, Pt4, Pt5, Pt6, Pt7.
|
Full Usage:
this.HasVolume
Returns: bool
Modifiers: inline |
Tests if none of the X, Y, and Z axes is smaller than the zeroLength tolerance. Same as .IsValid
|
Full Usage:
this.IntersectRay
Parameters:
Line3D
-
The ray (Line3D) to intersect with the box.
Returns: (float * float) voption
ValueNone if there is no intersection; otherwise, ValueSome(tEntry, tExit).
|
Intersects an infinite ray (Line3D extended infinitely in both directions) with this Box. Uses the slab intersection method in the box's local coordinate system. Returns ValueNone if the ray does not intersect the box or if the ray direction is too short. Returns ValueSome with entry and exit parameters on the ray if it intersects. A parameter of 0.0 corresponds to the ray's From point, 1.0 to its To point.
|
Full Usage:
this.IsFlat
Returns: bool
Modifiers: inline |
Tests if one of the X, Y, and Z axes is smaller than the zeroLength tolerance.
|
Full Usage:
this.IsLine
Returns: bool
Modifiers: inline |
Tests if two of the X, Y, and Z axes are smaller than the zeroLength tolerance.
|
Full Usage:
this.IsPoint
Returns: bool
Modifiers: inline |
Tests if all sides are smaller than the zeroLength tolerance. Same as b.IsZero.
|
Full Usage:
this.IsValid
Returns: bool
Modifiers: inline |
Tests if none of the X, Y, and Z axes are smaller than the zeroLength tolerance. Same as .HasVolume
|
Full Usage:
this.IsZero
Returns: bool
Modifiers: inline |
Tests if all sides are smaller than the zeroLength tolerance. Same as b.IsPoint.
|
|
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.
|
Full Usage:
this.LongestEdge
Returns: float
Modifiers: inline |
Returns the longest edge of the Box.
|
Full Usage:
this.LongestEdgeSq
Returns: float
Modifiers: inline |
Returns the square length of longest edge of the Box.
|
|
|
|
|
|
|
|
Creates a 3D Point from b.OriginX, b.OriginY and b.OriginZ
|
|
Gets the Plane that this box is based on.
|
|
Returns the bottom corners of the box in counter-clockwise order, starting at Origin. Then the top corners starting above Origin. Returns an array of 8 Points.
|
Returns point 0 of the box, same box.Origin.
|
|
Returns point 1 of the box.
|
|
Returns point 2 of the box.
|
|
Returns point 3 of the box.
|
|
Returns point 4 of the box.
|
|
Returns point 5 of the box.
|
|
Returns point 6 of the box.
|
|
Returns point 7 of the box.
|
|
|
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.
|
|
Multiplies (or applies) a Quaternion to a 3D box. The box is rotated around the World Origin.
|
Full Usage:
this.RotateWithCenter
Parameters:
Pnt
q : Quaternion
Returns: Box
Modifiers: inline |
Multiplies (or applies) a Quaternion to a 3D box around a given center point.
|
|
|
|
|
Full Usage:
this.ShortestEdge
Returns: float
Modifiers: inline |
Returns the shortest edge of the Box.
|
Full Usage:
this.ShortestEdgeSq
Returns: float
Modifiers: inline |
Returns the square length of shortest edge of the Box.
|
Full Usage:
this.SizeX
Returns: float
Modifiers: inline |
The size in X direction.
|
Full Usage:
this.SizeXSq
Returns: float
Modifiers: inline |
The size in X direction squared.
|
Full Usage:
this.SizeY
Returns: float
Modifiers: inline |
The size in Y direction.
|
Full Usage:
this.SizeYSq
Returns: float
Modifiers: inline |
The size in Y direction squared.
|
Full Usage:
this.SizeZ
Returns: float
Modifiers: inline |
The size in Z direction.
|
Full Usage:
this.SizeZSq
Returns: float
Modifiers: inline |
The size in Z direction squared.
|
|
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.
|
|
Multiplies (or applies) a RigidMatrix to a 3D box. The returned box is guaranteed to have still orthogonal vectors.
|
Full Usage:
this.Volume
Returns: float
Modifiers: inline |
Calculates the volume of the Box.
|
|
Creates a 3D Vector from b.XaxisX, b.XaxisY and b.XaxisZ
|
|
Creates a unitized version of the local X-axis.
|
|
Creates a 3D Vector from b.YaxisX, b.YaxisY and b.YaxisZ
|
|
Creates a unitized version of the local Y-axis.
|
|
Creates a 3D Vector from b.ZaxisX, b.ZaxisY and b.ZaxisZ
|
|
Creates a unitized version of the local Z-axis.
|
Static members
| Static member |
Description
|
|
|
|
|
|
|
|
Format box into string with nice floating point number formatting of X, Y and Z size only.
|
|
|
|
|
|
|
|
|
Full Usage:
Box.containsXYZ x y z b
Parameters:
float
y : float
z : float
b : Box
Returns: bool
Modifiers: inline |
Check for point containment in the Box. By doing six dot products with the box axes to test its six faces. A point exactly on the edge of the box is considered inside.
|
|
|
Full Usage:
Box.createFromBounds (minX, minY, minZ, maxX, maxY, maxZ)
Parameters:
float
minY : float
minZ : float
maxX : float
maxY : float
maxZ : float
Returns: Box
Modifiers: inline |
Creates a 3D box from the bounds (minX, minY, minZ) and (maxX, maxY, maxZ).
|
|
|
|
|
|
|
|
|
Full Usage:
Box.createUnchecked (originX, originY, originZ, xAxisX, xAxisY, xAxisZ, yAxisX, yAxisY, yAxisZ, zAxisX, zAxisY, zAxisZ)
Parameters:
float
originY : float
originZ : float
xAxisX : float
xAxisY : float
xAxisZ : float
yAxisX : float
yAxisY : float
yAxisZ : float
zAxisX : float
zAxisY : float
zAxisZ : float
Returns: Box
Modifiers: inline |
Create a box from origin coordinates and X-, Y-, and Z-axis vector components. It does NOT verify the orientation of vectors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns the 3D box expanded by a relative factor on all six sides, separately for X, Y, Z. Values between 0.0 and 1.0 shrink the box. Values larger than 1.0 expand the box. Does check for underflow if any factor is negative and raises EuclidException.
|
|
|
|
|
|
|
|
|
|
|
|
Returns the face of the box at the specified index. The order of the faces is: BottomFace, FrontFace, RightFace, BackFace, LeftFace, TopFace.
|
|
|
|
Tests if none of the X, Y, and Z axes is smaller than the zeroLength tolerance.
|
|
Intersects an infinite ray (Line3D extended infinitely in both directions) with the Box. Uses the slab intersection method in the box's local coordinate system. Returns ValueNone if the ray does not intersect the box or if the ray direction is too short. Returns ValueSome with entry and exit parameters on the ray if it intersects. A parameter of 0.0 corresponds to the ray's From point, 1.0 to its To point.
|
|
Tests if one of the X, Y, and Z axes is smaller than the zeroLength tolerance.
|
|
Tests if two of the X, Y, and Z axes are smaller than the zeroLength tolerance.
|
|
Tests if all sides are smaller than the zeroLength tolerance. Same as Box.isZero.
|
|
Tests if none of the X, Y, and Z axes are smaller than the zeroLength tolerance.
|
|
Tests if all sides are smaller than the zeroLength tolerance. Same as Box.isPoint.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Multiplies (or applies) a Quaternion to a 3D box. The box IsRotated around the World Origin.
|
Full Usage:
Box.rotateWithCenter cen q b
Parameters:
Pnt
q : Quaternion
b : Box
Returns: Box
Modifiers: inline |
Multiplies (or applies) a Quaternion to a 3D box around a given center point.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
Box.transformRigid m b
Parameters:
RigidMatrix
b : Box
Returns: Box
Modifiers: inline |
Transforms the box by the given RigidMatrix. The returned box is guaranteed to have still orthogonal vectors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Euclid