GlobalTransform — Aspose.3D FOSS for Python API Reference
Example
GlobalTransform הוא קריאה בלבד תמונת מצב של Nodeהטרנספורמציה במרחב‑העולם של ’s. היא מתקבלת דרך node.global_transform ומשקפת את הרכבה של ה‑node עצמו Transform עם הטרנספורמציה של כל הצאצאים עד לשורש הסצנה.
כל המאפיינים הם קריאה בלבד. כדי לשנות את מיקום ה‑node, שנה את ה‑local של ה‑node Transform במקום זאת.
Example: aspose.threed
from aspose.threed import GlobalTransformGlobalTransform לא נוצר בדרך כלל node.global_transform.
Example
| Example | Example | Example |
|---|---|---|
translation | Vector3 | מיקום במרחב‑העולם של ה‑node |
scale | Vector3 | קנה מידה במרחב‑העולם של ה‑node |
rotation | Quaternion | סיבוב במרחב‑העולם כקוואטרניון |
euler_angles | Vector3 | סיבוב במרחב‑העולם כזוויות אוילר ברדיאנים (roll, pitch, yaw) |
transform_matrix | Matrix4 | מטריצה מלאה 4×4 של טרנספורמציה במרחב‑העולם |
Example
from aspose.threed import Scene
from aspose.threed.utilities import Vector3
import math
scene = Scene()
# Create a parent node at (10, 0, 0)
parent = scene.root_node.create_child_node("parent")
parent.transform.translation = Vector3(10.0, 0.0, 0.0)
# Create a child node at (5, 0, 0) relative to parent
child = parent.create_child_node("child")
child.transform.translation = Vector3(5.0, 0.0, 0.0)
# Read world-space position
gt = child.global_transform
print(gt.translation) # Vector3(15.0, 0.0, 0.0)
print(gt.scale) # Vector3(1.0, 1.0, 1.0)
# Access the 4x4 matrix directly
mat = gt.transform_matrix
print(mat.m03) # 15.0 — world-space X translation
# Euler angles in degrees
angles = gt.euler_angles
print(math.degrees(angles.x)) # 0.0 (no rotation)
# Using evaluate_global_transform to include geometric offset
manual_mat = child.evaluate_global_transform(True)Example
GlobalTransformמחושבת בזמןnode.global_transformנגיש; היא לא מתעדכן דינמית אם של צומת הורהTransformשינויים מאוחרים יותר.- Example
scaleשם המאפיין עלGlobalTransformהואscale(לאscaling)Transformמשתמשscalingעבור מאפיין הסקלה הניתן לכתיבה.