GlobalTransform

GlobalTransform — Aspose.3D FOSS for Java

Methods

GlobalTransform เป็น อ่านอย่างเดียว สแนปช็อตของ Nodeการแปลงในพื้นที่โลกของ ’s. ได้รับผ่าน node.getGlobalTransform() และสะท้อนการประกอบของโหนดเอง Transform กับการแปลงของบรรพบุรุษทุกระดับจนถึงรากของฉาก.

คุณสมบัติทั้งหมดเป็นแบบอ่านอย่างเดียว. เพื่อเปลี่ยนตำแหน่งของโหนด, ให้แก้ไขค่า local ของโหนด Transform แทน.

Methods: com.aspose.threed

import com.aspose.threed.GlobalTransform;

GlobalTransform โดยปกติจะไม่สร้างโดยตรง; คุณจะได้รับจาก node.getGlobalTransform().

Methods

MethodsMethodsMethodsMethods
translationVector3getTranslation()ตำแหน่งในพื้นที่โลกของโหนด
scaleVector3getScale()สเกลในพื้นที่โลกของโหนด
rotationQuaterniongetRotation()การหมุนในพื้นที่โลกเป็น quaternion
eulerAnglesVector3getEulerAngles()การหมุนในพื้นที่โลกเป็นมุมออยเลอร์ในเรเดียน (roll, pitch, yaw)
transformMatrixMatrix4getTransformMatrix()เมทริกซ์การแปลง 4x4 ในพื้นที่โลกที่สมบูรณ์

Methods

import com.aspose.threed.Scene;
import com.aspose.threed.Node;
import com.aspose.threed.GlobalTransform;
import com.aspose.threed.*;


Scene scene = new Scene();

// Create a parent node at (10, 0, 0)
Node parent = scene.getRootNode().createChildNode("parent");
parent.getTransform().setTranslation(new Vector3(10.0, 0.0, 0.0));

// Create a child node at (5, 0, 0) relative to parent
Node child = parent.createChildNode("child");
child.getTransform().setTranslation(new Vector3(5.0, 0.0, 0.0));

// Read world-space position
GlobalTransform gt = child.getGlobalTransform();
System.out.println(gt.getTranslation());          // Vector3(15.0, 0.0, 0.0)
System.out.println(gt.getScale());                 // Vector3(1.0, 1.0, 1.0)

// Access the 4x4 matrix directly
Matrix4 mat = gt.getTransformMatrix();
System.out.println(mat.m03);   // 15.0 -- world-space X translation

// Euler angles in degrees
Vector3 angles = gt.getEulerAngles();
System.out.println(Math.toDegrees(angles.x));   // 0.0 (no rotation)

// Using evaluateGlobalTransform to include geometric offset
Matrix4 manualMat = child.evaluateGlobalTransform(true);

Methods

  • GlobalTransform จะคำนวณในขณะ node.getGlobalTransform() ถูกเข้าถึง; มันคือ ไม่ อัปเดตแบบไดนามิกหากโหนดแม่ของ Transform การเปลี่ยนแปลงต่อม.
  • ตัว getter คือ getScale() บน GlobalTransform (ไม่ getScaling()) Transform ใช้ getScaling() สำหรับคุณสมบัติสเกลที่เขียนได้.

ดูเพิ่มเติม

 ภาษาไทย