GlobalTransform — Aspose.3D FOSS for Java
Notes
GlobalTransform ir tikai lasāms momentuzņēmums no Node’s pasaules telpas transformācija. To tiek iegūts, izmantojot node.getGlobalTransform() un atspoguļo mezgla paša Transform ar katra priekšgājēja transformāciju līdz ainas saknei.
Visas īpašības ir tikai lasāmas. Lai mainītu mezgla pozīciju, modificējiet mezgla lokālo Transform tā vietā.
Notes: com.aspose.threed
import com.aspose.threed.GlobalTransform;GlobalTransform parasti netiek tieši instanceizēts; jūs to saņemat no node.getGlobalTransform().
Notes
| Notes | Notes | Notes | Notes |
|---|---|---|---|
translation | Vector3 | getTranslation() | Mezgla pozīcija pasaules telpā |
scale | Vector3 | getScale() | Mezgla mērogs pasaules telpā |
rotation | Quaternion | getRotation() | Pasaules telpā rotācija kā kvaternions |
eulerAngles | Vector3 | getEulerAngles() | Pasaules telpā rotācija kā Eilera leņķi radiānos (roll, pitch, yaw) |
transformMatrix | Matrix4 | getTransformMatrix() | Pilna 4x4 pasaules telpas transformācijas matrica |
Notes
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);Notes
GlobalTransformtiek aprēķināts brīdīnode.getGlobalTransform()tiek piekļūts; tas ir ne atjaunināts dinamiskā veidā, ja vecāka mezglaTransformvēlākas izmaiņas.- Getter ir
getScale()uzGlobalTransform(negetScaling()). VietējaisTransformizmantogetScaling()rakstāmas mēroga īpašībai.