BoundingBox — Aspose.3D FOSS for Java

Example

BoundingBox mewakili kotak pembatas yang sejajar sumbu (AABB) yang didefinisikan oleh dua Vector3 sudut – ekstensi minimum dan maksimum. Ini dikembalikan oleh Node.getBoundingBox() dan digunakan untuk kueri spasial, pemangkasan frustum, serta perhitungan ukuran.

Example: com.aspose.threed

import com.aspose.threed.*;

Example

ExampleExampleExampleExample
minimumVector3getMinimum()Sudut dengan nilai x, y, z terkecil
maximumVector3getMaximum()Sudut dengan nilai x, y, z terbesar

Example

ExampleTipe PengembalianExample
merge(Vector3 point)voidPerluas kotak pembatas untuk menyertakan titik yang diberikan
merge(BoundingBox other)voidPerluas kotak pembatas untuk menampung kotak pembatas lain

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

Lihat Juga

 Bahasa Indonesia