subtract

fun Box.subtract(other: Box): List<Box>(source)

Subtracts the given Box from the current Box and returns the remaining parts of the current Box that do not intersect with the given Box.

The method splits the current Box along the edges of the other Box in all three dimensions (x, y, z) to effectively remove the intersecting portion. Non-intersecting parts are returned as a list of Boxes. If there is no intersection, the method returns the current Box as a single-element list.

Return

A list of Boxes representing the remaining parts of the current Box after subtraction.

Parameters

other

The Box to subtract from the current Box.


fun List<Box>.subtract(other: Box): List<Box>(source)

Subtracts a given Box from each Box in the list and returns a list of the resulting Boxes.

This method applies the subtraction operation for a given Box (other) to every Box in the current list. The subtraction operation removes the overlapping region between the current Box and other, and returns the non-intersecting parts as a list of Boxes.

Return

A new list of Boxes where every Box represents the remaining parts after subtracting other.

Parameters

other

The Box to subtract from each Box in the list.


fun Rectangle.subtract(other: Rectangle): List<Rectangle>(source)

Subtracts the given rectangle other from the current rectangle, splitting and removing overlapping areas and returning the remaining non-overlapping parts as a list of rectangles.

Return

A list of rectangles representing the non-overlapping parts of the current rectangle after the subtraction. If there is no intersection, the list contains only the original rectangle.

Parameters

other

The rectangle to subtract from the current rectangle.


fun List<Rectangle>.subtract(other: Rectangle): List<Rectangle>(source)

Subtracts a rectangle from a list of rectangles, removing overlapping areas and returning the non-overlapping parts of the original rectangles.

Return

A list of rectangles representing the non-overlapping areas from the subtraction of the specified rectangle.

Parameters

other

The rectangle to subtract from the list of rectangles.