FreeBox Type
A mutable class containing a flat array of 24 floats representing an arbitrary 3D box-like topology. The 8 corner points are stored interleaved as x0, y0, z0, x1, y1, z1, ... x7, y7, z7. The points can be in arbitrary position in space. The instance members for transformations, like Move, Scale or Rotate, mutate the FreeBox in place and return unit. Their static counterparts, like FreeBox.move, FreeBox.scale or FreeBox.rotate, return a new FreeBox and leave the input unchanged. The indexed point setters and movers, setPoint, setXYZ, movePoint and moveXYZ, mutate in place and return unit, as instance and as static members. So do the setters of the corner properties, like Pnt0 or Pnt0X. Taking a point index alone does not mean mutation: getPoint and getLine only read the FreeBox. XYZs and xyzs expose the live coordinate array, changes to it change the FreeBox.
7 6
+---------------+
/| /|
/ | / |
4 / | 5 / |
+---------------+ |
| | | |
| +-----------|---+
| / 3 | / 2
| / | /
|/ |/
+---------------+
0 1
Instance members
| Instance member |
Description
|
Full Usage:
this.AsFSharpCode
Returns: string
|
Format FreeBox into an F# code string that can be used to recreate the box.
|
|
Converts the flat float buffer of the FreeBox into an array of the 8 corner points. Use .XYZs to access the live internal buffer.
|
Full Usage:
this.AsString
Returns: string
|
Nicely formatted string representation of the box including Pnt0.
|
|
Creates a copy of this FreeBox. Same as Duplicate().
|
|
Creates a copy of this FreeBox. Same as Clone().
|
|
Returns the edge between point 0 and point 1.
|
|
Returns the edge between point 0 and point 3.
|
|
Returns the edge between point 0 and point 4.
|
|
Returns the edge between point 1 and point 0. This is the reverse of Edge01.
|
|
Returns the edge between point 1 and point 2.
|
|
Returns the edge between point 1 and point 5.
|
|
Returns the edge between point 2 and point 1. This is the reverse of Edge12.
|
|
Returns the edge between point 2 and point 3. This is the reverse of Edge32.
|
|
Returns the edge between point 2 and point 6.
|
|
Returns the edge between point 3 and point 0. This is the reverse of Edge03.
|
|
Returns the edge between point 3 and point 2.
|
|
Returns the edge between point 3 and point 7.
|
|
Returns the edge between point 4 and point 0. This is the reverse of Edge04.
|
|
Returns the edge between point 4 and point 5.
|
|
Returns the edge between point 4 and point 7.
|
|
Returns the edge between point 5 and point 1. This is the reverse of Edge15.
|
|
Returns the edge between point 5 and point 4. This is the reverse of Edge45.
|
|
Returns the edge between point 5 and point 6.
|
|
Returns the edge between point 6 and point 2. This is the reverse of Edge26.
|
|
Returns the edge between point 6 and point 5. This is the reverse of Edge56.
|
|
Returns the edge between point 6 and point 7. This is the reverse of Edge76.
|
|
Returns the edge between point 7 and point 3. This is the reverse of Edge37.
|
|
Returns the edge between point 7 and point 4. This is the reverse of Edge47.
|
|
Returns the edge between point 7 and point 6.
|
|
Returns the 12 box edges. 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.GetLine
Parameters:
int
-
The index of the corner point where the line starts. Must be between 0 and 7.
endPointIndex : int
-
The index of the corner point where the line ends. Must be between 0 and 7 and different from startPointIndex.
Returns: Line3D
A Line3D from the start corner point to the end corner point.
|
Returns the line from the corner point at the start index to the corner point at the end index. Any two different indices from 0 to 7 are valid, so besides the 12 edges this also returns face diagonals and space diagonals. The direction of the line follows the order of the indices: GetLine 0 1 is Edge01 and GetLine 1 0 is Edge10.
|
|
Get the point at the given point index. The index must be between 0 and 7. (this gets Pnt(XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1], XYZs.[pointIndex * 3 + 2]) from the internal flat array of x, y, and z coordinates)
|
Full Usage:
this.GetX
Parameters:
int
Returns: float
|
Get the x coordinate of the point at the given point index. The index must be between 0 and 7. (this gets XYZs.[pointIndex * 3] from the internal flat array of x, y, and z coordinates)
|
Full Usage:
this.GetY
Parameters:
int
Returns: float
|
Get the y coordinate of the point at the given point index. The index must be between 0 and 7. (this gets XYZs.[pointIndex * 3 + 1] from the internal flat array of x, y, and z coordinates)
|
Full Usage:
this.GetZ
Parameters:
int
Returns: float
|
Get the z coordinate of the point at the given point index. The index must be between 0 and 7. (this gets XYZs.[pointIndex * 3 + 2] from the internal flat array of x, y, and z coordinates)
|
Moves the FreeBox in place by a vector.
|
|
Full Usage:
this.MovePoint
Parameters:
int
-
The index of the point to move. Must be between 0 and 7.
v : Vec
-
The vector to move the point by.
|
Moves the point at the given point index in place by a vector. The other 7 points stay where they are. (this adds v.X, v.Y and v.Z to XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1] and XYZs.[pointIndex * 3 + 2] of the internal flat array of x, y, and z coordinates)
|
Full Usage:
this.MoveX
Parameters:
float
|
Moves the FreeBox in place by a given distance in world X direction.
|
Full Usage:
this.MoveXYZ
Parameters:
int
-
The index of the point to move. Must be between 0 and 7.
x : float
-
The distance to move the point in X direction.
y : float
-
The distance to move the point in Y direction.
z : float
-
The distance to move the point in Z direction.
|
Moves the point at the given point index in place by the given x, y, and z distances. The other 7 points stay where they are. (this adds x, y and z to XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1] and XYZs.[pointIndex * 3 + 2] of the internal flat array of x, y, and z coordinates)
|
Full Usage:
this.MoveY
Parameters:
float
|
Moves the FreeBox in place by a given distance in world Y direction.
|
Full Usage:
this.MoveZ
Parameters:
float
|
Moves the FreeBox in place by a given distance in world Z direction.
|
Gets or sets the point 0 of the box. (this gets or sets XYZs.[0], XYZs.[1] and XYZs.[2] of the internal flat array of x, y, and z coordinates)
|
|
Full Usage:
this.Pnt0X
Returns: float
|
Gets or sets the X coordinate of the point 0 of the box. (this gets or sets XYZs.[0] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt0Y
Returns: float
|
Gets or sets the Y coordinate of the point 0 of the box. (this gets or sets XYZs.[1] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt0Z
Returns: float
|
Gets or sets the Z coordinate of the point 0 of the box. (this gets or sets XYZs.[2] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Gets or sets the point 1 of the box. (this gets or sets XYZs.[3], XYZs.[4] and XYZs.[5] of the internal flat array of x, y, and z coordinates)
|
|
Full Usage:
this.Pnt1X
Returns: float
|
Gets or sets the X coordinate of the point 1 of the box. (this gets or sets XYZs.[3] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt1Y
Returns: float
|
Gets or sets the Y coordinate of the point 1 of the box. (this gets or sets XYZs.[4] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt1Z
Returns: float
|
Gets or sets the Z coordinate of the point 1 of the box. (this gets or sets XYZs.[5] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Gets or sets the point 2 of the box. (this gets or sets XYZs.[6], XYZs.[7] and XYZs.[8] of the internal flat array of x, y, and z coordinates)
|
|
Full Usage:
this.Pnt2X
Returns: float
|
Gets or sets the X coordinate of the point 2 of the box. (this gets or sets XYZs.[6] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt2Y
Returns: float
|
Gets or sets the Y coordinate of the point 2 of the box. (this gets or sets XYZs.[7] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt2Z
Returns: float
|
Gets or sets the Z coordinate of the point 2 of the box. (this gets or sets XYZs.[8] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Gets or sets the point 3 of the box. (this gets or sets XYZs.[9], XYZs.[10] and XYZs.[11] of the internal flat array of x, y, and z coordinates)
|
|
Full Usage:
this.Pnt3X
Returns: float
|
Gets or sets the X coordinate of the point 3 of the box. (this gets or sets XYZs.[9] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt3Y
Returns: float
|
Gets or sets the Y coordinate of the point 3 of the box. (this gets or sets XYZs.[10] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt3Z
Returns: float
|
Gets or sets the Z coordinate of the point 3 of the box. (this gets or sets XYZs.[11] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Gets or sets the point 4 of the box. (this gets or sets XYZs.[12], XYZs.[13] and XYZs.[14] of the internal flat array of x, y, and z coordinates)
|
|
Full Usage:
this.Pnt4X
Returns: float
|
Gets or sets the X coordinate of the point 4 of the box. (this gets or sets XYZs.[12] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt4Y
Returns: float
|
Gets or sets the Y coordinate of the point 4 of the box. (this gets or sets XYZs.[13] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt4Z
Returns: float
|
Gets or sets the Z coordinate of the point 4 of the box. (this gets or sets XYZs.[14] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Gets or sets the point 5 of the box. (this gets or sets XYZs.[15], XYZs.[16] and XYZs.[17] of the internal flat array of x, y, and z coordinates)
|
|
Full Usage:
this.Pnt5X
Returns: float
|
Gets or sets the X coordinate of the point 5 of the box. (this gets or sets XYZs.[15] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt5Y
Returns: float
|
Gets or sets the Y coordinate of the point 5 of the box. (this gets or sets XYZs.[16] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt5Z
Returns: float
|
Gets or sets the Z coordinate of the point 5 of the box. (this gets or sets XYZs.[17] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Gets or sets the point 6 of the box. (this gets or sets XYZs.[18], XYZs.[19] and XYZs.[20] of the internal flat array of x, y, and z coordinates)
|
|
Full Usage:
this.Pnt6X
Returns: float
|
Gets or sets the X coordinate of the point 6 of the box. (this gets or sets XYZs.[18] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt6Y
Returns: float
|
Gets or sets the Y coordinate of the point 6 of the box. (this gets or sets XYZs.[19] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt6Z
Returns: float
|
Gets or sets the Z coordinate of the point 6 of the box. (this gets or sets XYZs.[20] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Gets or sets the point 7 of the box. (this gets or sets XYZs.[21], XYZs.[22] and XYZs.[23] of the internal flat array of x, y, and z coordinates)
|
|
Full Usage:
this.Pnt7X
Returns: float
|
Gets or sets the X coordinate of the point 7 of the box. (this gets or sets XYZs.[21] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt7Y
Returns: float
|
Gets or sets the Y coordinate of the point 7 of the box. (this gets or sets XYZs.[22] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
Full Usage:
this.Pnt7Z
Returns: float
|
Gets or sets the Z coordinate of the point 7 of the box. (this gets or sets XYZs.[23] of the internal flat array of x, y, and z coordinates) Setting it mutates the FreeBox in place.
|
|
Rotates the FreeBox in place by a Quaternion. The box is rotated around the World Origin.
|
Full Usage:
this.RotateAround
Parameters:
Pnt
-
The center point of the rotation.
q : Quaternion
-
The rotation to apply.
|
Rotates the FreeBox in place by a Quaternion around a given center point.
|
Full Usage:
this.Scale
Parameters:
float
|
Scales the FreeBox in place by a given factor on the world origin (0, 0, 0).
|
Full Usage:
this.ScaleOn
Parameters:
Pnt
-
The center point of the scaling.
factor : float
-
The scale factor.
|
Scales the FreeBox in place by a given factor around a given center point.
|
|
Sets the point at the given point index. The index must be between 0 and 7. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1] and XYZs.[pointIndex * 3 + 2] of the internal flat array of x, y, and z coordinates)
|
Full Usage:
this.SetXYZ
Parameters:
int
x : float
y : float
z : float
|
Sets the x, y, and z coordinates of the point at the given point index. The index must be between 0 and 7. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1] and XYZs.[pointIndex * 3 + 2] of the internal flat array of x, y, and z coordinates)
|
|
Applies a 4x4 transformation matrix to the FreeBox in place.
|
|
Applies a RigidMatrix to the FreeBox in place.
|
Full Usage:
this.XYZs
Returns: float[]
|
Gets the X, Y and Z interleaved array of 24 floats of the box: x0, y0, z0, x1, y1, z1, ... x7, y7, z7. This is the live internal buffer, so changes to the array will be reflected in the FreeBox.
|
Static members
| Static member |
Description
|
|
Format FreeBox into an F# code string that can be used to recreate the box.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Creates a FreeBox from a flat array of 24 floats: x0, y0, z0, x1, y1, z1, ... x7, y7, z7. The array is used directly as the internal buffer, it is not copied: later changes to the array will be reflected in the FreeBox, and vice versa.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
FreeBox.getX pointIndex b
Parameters:
int
b : FreeBox
Returns: float
Modifiers: inline |
Get the x coordinate of the point at the given point index. The index must be between 0 and 7. (this gets XYZs.[pointIndex * 3] from the internal flat array of x, y, and z coordinates)
|
Full Usage:
FreeBox.getY pointIndex b
Parameters:
int
b : FreeBox
Returns: float
Modifiers: inline |
Get the y coordinate of the point at the given point index. The index must be between 0 and 7. (this gets XYZs.[pointIndex * 3 + 1] from the internal flat array of x, y, and z coordinates)
|
Full Usage:
FreeBox.getZ pointIndex b
Parameters:
int
b : FreeBox
Returns: float
Modifiers: inline |
Get the z coordinate of the point at the given point index. The index must be between 0 and 7. (this gets XYZs.[pointIndex * 3 + 2] from the internal flat array of x, y, and z coordinates)
|
|
|
|
|
|
|
Full Usage:
FreeBox.moveXYZ pointIndex x y z b
Parameters:
int
-
The index of the point to move. Must be between 0 and 7.
x : float
-
The distance to move the point in X direction.
y : float
-
The distance to move the point in Y direction.
z : float
-
The distance to move the point in Z direction.
b : FreeBox
-
The FreeBox to change.
Modifiers: inline |
Moves the point at the given point index in place by the given x, y, and z distances. The other 7 points stay where they are.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
FreeBox.rotate q b
Parameters:
Quaternion
b : FreeBox
Returns: FreeBox
Modifiers: inline |
Returns a new FreeBox rotated by a Quaternion. The input FreeBox is not changed. The box is rotated around the World Origin.
|
Full Usage:
FreeBox.rotateAround cen q b
Parameters:
Pnt
-
The center point of the rotation.
q : Quaternion
-
The rotation to apply.
b : FreeBox
-
The FreeBox to rotate. It is not changed.
Returns: FreeBox
A new FreeBox. Use b.RotateAround to rotate in place.
Modifiers: inline |
Returns a new FreeBox rotated by a Quaternion around a given center point.
|
|
|
|
|
|
|
Full Usage:
FreeBox.setXYZ pointIndex x y z b
Parameters:
int
x : float
y : float
z : float
b : FreeBox
Modifiers: inline |
Sets the x, y, and z coordinates of the point at the given point index. The index must be between 0 and 7. (this sets XYZs.[pointIndex * 3], XYZs.[pointIndex * 3 + 1] and XYZs.[pointIndex * 3 + 2] of the internal flat array of x, y, and z coordinates)
|
|
|
Full Usage:
FreeBox.transformRigid m b
Parameters:
RigidMatrix
b : FreeBox
Returns: FreeBox
Modifiers: inline |
Returns a new FreeBox transformed by a RigidMatrix. The input FreeBox is not changed.
|
|
Gets the X, Y and Z interleaved array of 24 floats of the box: x0, y0, z0, x1, y1, z1, ... x7, y7, z7. This is the live internal buffer, so changes to the array will be reflected in the FreeBox.
|
Euclid