BoundingBox — Aspose.3D FOSS for Java

Example

BoundingBox يمثل صندوق حدود محاذى للمحاور (AABB) يُعرّف بواسطة اثنين Vector3 الزوايا – الحد الأدنى والحد الأقصى. يتم إرجاعه بواسطة Node.getBoundingBox() ويُستخدم في الاستعلامات المكانية، وإزالة الأجزاء غير المرئية (frustum culling)، وحسابات الحجم.

Example: com.aspose.threed

import com.aspose.threed.*;

Example

ExampleExampleExampleExample
minimumVector3getMinimum()الزاوية التي لها أصغر قيم x, y, z
maximumVector3getMaximum()الزاوية التي لها أكبر قيم x, y, z

Example

Exampleنوع الإرجاعExample
merge(Vector3 point)voidتوسيع صندوق الحدود ليشمل النقطة المعطاة
merge(BoundingBox other)voidتوسيع صندوق الحدود ليحتوي صندوق حدود آخر

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

انظر أيضًا

 العربية