BoundingBox — Aspose.3D FOSS for Java
Overview
BoundingBox represents an axis-aligned bounding box (AABB) defined by two Vector3 corners – the minimum and maximum extents. It is returned by Node.getBoundingBox() and is used for spatial queries, frustum culling, and size calculations.
Package: com.aspose.threed
import com.aspose.threed.*;Properties
| Name | Type | Getter | Description |
|---|---|---|---|
minimum | Vector3 | getMinimum() | The corner with the smallest x, y, z values |
maximum | Vector3 | getMaximum() | The corner with the largest x, y, z values |
Methods
| Method | Return Type | Description |
|---|---|---|
merge(Vector3 point) | void | Expand the bounding box to include the given point |
merge(BoundingBox other) | void | Expand the bounding box to enclose another bounding box |
Example
import com.aspose.threed.Scene;
import com.aspose.threed.Node;
import com.aspose.threed.*;
Scene scene = Scene.fromFile("model.obj");
for (Node node : scene.getRootNode().getChildNodes()) {
BoundingBox bbox = node.getBoundingBox();
Vector3 min = bbox.getMinimum();
Vector3 max = bbox.getMaximum();
System.out.println("Node '" + node.getName() + "':");
System.out.println(" Min: " + min);
System.out.println(" Max: " + max);
System.out.println(" Size X: " + (max.x - min.x));
System.out.println(" Size Y: " + (max.y - min.y));
System.out.println(" Size Z: " + (max.z - min.z));
}