BoundingBox — Aspose.3D FOSS for Java

Example

BoundingBox đại diện cho một hộp bao trùm (AABB) căn chỉnh trục được định nghĩa bởi hai Vector3 đỉnh – các giới hạn tối thiểu và tối đa. Nó được trả về bởi Node.getBoundingBox() và được sử dụng cho các truy vấn không gian, loại bỏ frustum, và tính toán kích thước.

Example: com.aspose.threed

import com.aspose.threed.*;

Example

ExampleExampleExampleExample
minimumVector3getMinimum()Đỉnh có giá trị x, y, z nhỏ nhất
maximumVector3getMaximum()Đỉnh có giá trị x, y, z lớn nhất

Example

ExampleKiểu trả vềExample
merge(Vector3 point)voidMở rộng hộp bao trùm để bao gồm điểm đã cho
merge(BoundingBox other)voidMở rộng hộp bao trùm để chứa một hộp bao trùm khác

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));
}

Xem thêm

 Tiếng Việt