GlobalTransform — Aspose.3D FOSS for Python API Reference

Example

GlobalTransform هو للقراءة فقط لقطة من Nodeتحويل الفضاء العالمي. يتم الحصول عليه عبر node.global_transform ويعكس تركيب الخاص بالعقدة Transform مع تحويل كل سلف حتى جذر المشهد.

جميع الخصائص للقراءة فقط. لتغيير موضع العقدة، عدّل المحلي الخاص بالعقدة Transform بدلاً من ذلك.

Example: aspose.threed

from aspose.threed import GlobalTransform

GlobalTransform عادةً لا يتم إنشاءه مباشرة؛ تحصل عليه من node.global_transform.

Example

ExampleExampleExample
translationVector3موضع الفضاء العالمي للعقدة
scaleVector3مقياس الفضاء العالمي للعقدة
rotationQuaternionدوران الفضاء العالمي كـ quaternion
euler_anglesVector3دوران الفضاء العالمي كزوايا أويلر بالراديان (roll, pitch, yaw)
transform_matrixMatrix4مصفوفة التحويل الكاملة 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 لخاصية المقياس القابلة للكتابة.

انظر أيضًا

 العربية