GlobalTransform — Aspose.3D FOSS for Java
Methods
GlobalTransform е само за четене снимка на Nodeтрансформация в световното пространство. Получава се чрез node.getGlobalTransform() и отразява композицията на собствената на възела Transform с трансформацията на всеки предшественик до корена на сцената.
Всички свойства са само за четене. За да промените позицията на възела, променете локалната Transform вместо това.
Methods: com.aspose.threed
import com.aspose.threed.GlobalTransform;GlobalTransform не се създава обикновено директно; получавате го от node.getGlobalTransform().
Methods
| Methods | Methods | Methods | Methods |
|---|---|---|---|
translation | Vector3 | getTranslation() | Позиция в световното пространство на възела |
scale | Vector3 | getScale() | Мащаб в световното пространство на възела |
rotation | Quaternion | getRotation() | Ротация в световното пространство като кватернион |
eulerAngles | Vector3 | getEulerAngles() | Ротация в световното пространство като ъгли на Юлер в радиани (roll, pitch, yaw) |
transformMatrix | Matrix4 | getTransformMatrix() | Пълна 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по-късно се променя.- Гетърът е
getScale()наGlobalTransform(неgetScaling()). ЛокалниятTransformизползваgetScaling()за свойството за записваем мащаб.