Box

@Serializable
data class Box(val corner: Vector3, val width: Double, val height: Double, val depth: Double) : LinearType<Box> , Movable3D, Scalable3D(source)

Represents a 3D rectangular cuboid defined by its corner position, width, height, and depth.

This class provides a number of geometric and mathematical operations, transformations, and utility functions for working with 3D boxes. It implements LinearType for linear algebra operations, as well as Movable3D and Scalable3D for 3D manipulation.

Parameters

corner

The position of the corner of the box.

width

The width of the box along the X-axis.

height

The height of the box along the Y-axis.

depth

The depth of the box along the Z-axis.

Constructors

Link copied to clipboard
constructor(corner: Vector3, width: Double, height: Double, depth: Double)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Represents the center of the box.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Provides the dimensions of the box as a Vector3, where the x, y, and z components represent the width, height, and depth of the box respectively.

Link copied to clipboard
Link copied to clipboard

Determines the axis along which the box has its greatest dimension.

Link copied to clipboard

Represents the axis corresponding to the smallest dimension of the box.

Link copied to clipboard

Returns a normalized version of the current box.

Link copied to clipboard

The calculated volume of the box. This value is computed as the product of the box's width, height, and depth. Represents the 3D space occupied by the box in cubic units.

Link copied to clipboard
Link copied to clipboard

Represents the range along the X-axis for the box.

Link copied to clipboard

Represents the range along the Y-axis for the box.

Link copied to clipboard

Represents the range along the Z-axis for the box.

Functions

Link copied to clipboard
operator fun contains(point: Vector3): Boolean

Return true if given point is inside the Box.

Link copied to clipboard
open operator override fun div(scale: Double): Box
Link copied to clipboard
fun intersects(other: Box): Boolean

Return true if the volumes of two boxes intersect.

Link copied to clipboard
fun mapTo(target: Box): Matrix44
Link copied to clipboard
open operator override fun minus(right: Box): Box
Link copied to clipboard
open override fun movedBy(offset: Vector3): Box

Creates a new shape with the same size but the current position offset by the given amount.

Link copied to clipboard
open override fun movedTo(position: Vector3): Box

Creates a new shape with the same size but the current position is set to position.

Link copied to clipboard
fun offsetSides(offset: Double, offsetY: Double = offset, offsetZ: Double = offset): Box

Return a copy of the box with sides offset

Link copied to clipboard
open operator override fun plus(right: Box): Box
Link copied to clipboard

Calculates the position within the box based on the given relative coordinates.

Link copied to clipboard
fun ratio(axis: Vector3.Axis = majorAxis): Box
Link copied to clipboard
open override fun scaledBy(scale: Double, uAnchor: Double, vAnchor: Double, wAnchor: Double): Box
open override fun scaledBy(xScale: Double, yScale: Double, zScale: Double, uAnchor: Double, vAnchor: Double, wAnchor: Double): Box
Link copied to clipboard
Link copied to clipboard
open operator override fun times(scale: Double): Box
Link copied to clipboard
fun toInt(): IntBox

Convert to IntBox