Transform — Aspose.3D FOSS for Java
Enumerations: com.aspose.threed (aspose-3d-foss)
Transform एक की position, orientation, और scale को नियंत्रित करता है Node 3D सीन में। प्रत्येक नोड के पास ठीक एक Transform, जिसे एक्सेस किया जाता है node.getTransform().
public class Transform extends A3DObjectएक नोड के Transform तक पहुँच
import com.aspose.threed.Scene;
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("box");
Transform t = node.getTransform();Enumerations
| Enumerations | Enumerations | Enumerations | Enumerations | Enumerations |
|---|---|---|---|---|
translation | Vector3 | getTranslation() | setTranslation(Vector3) | पैरेंट नोड की मूल बिंदु से Position ऑफसेट। डिफ़ॉल्ट Vector3(0, 0, 0). |
scaling | Vector3 | getScaling() | setScaling(Vector3) | प्रति अक्ष Non-uniform scale फैक्टर। डिफ़ॉल्ट Vector3(1, 1, 1). |
rotation | Quaternion | getRotation() | setRotation(Quaternion) | Rotation को एक unit quaternion के रूप में। इसे सेट करने से Euler angles भी अपडेट होते हैं।. |
eulerAngles | Vector3 | getEulerAngles() | setEulerAngles(Vector3) | Rotation को डिग्री में (X, Y, Z) Euler angles के रूप में। इसे सेट करने से quaternion rotation भी अपडेट होता है।. |
preRotation | Vector3 | getPreRotation() | setPreRotation(Vector3) | मुख्य घूर्णन से पहले लागू किए गए Euler angles (FBX rigs में उपयोग किए जाते हैं)।. |
postRotation | Vector3 | getPostRotation() | setPostRotation(Vector3) | मुख्य घूर्णन के बाद लागू किए गए Euler angles।. |
geometricTranslation | Vector3 | getGeometricTranslation() | setGeometricTranslation(Vector3) | केवल स्थानीय translation: ज्यामिति को प्रभावित करता है लेकिन चाइल्ड नोड्स को नहीं।. |
geometricScaling | Vector3 | getGeometricScaling() | setGeometricScaling(Vector3) | केवल स्थानीय scale: ज्यामिति को प्रभावित करता है लेकिन चाइल्ड नोड्स को नहीं।. |
geometricRotation | Vector3 | getGeometricRotation() | setGeometricRotation(Vector3) | स्थानीय-केवल घूर्णन: ज्यामिति को प्रभावित करता है लेकिन चाइल्ड नोड्स को नहीं।. |
transformMatrix | Matrix4 | getTransformMatrix() | setTransformMatrix(Matrix4) | पूरा संयुक्त 4x4 ट्रांसफ़ॉर्मेशन मैट्रिक्स। कैश्ड; जब भी कोई घटक बदलता है तो पुनः गणना किया जाता है। इसे सेट करने पर यह अनुवाद/स्केलिंग/रोटेशन में वापस विभाजित हो जाता है।. |
फ़्लुएंट सेट्टर मेथड्स
सभी सेटर्स रिटर्न करते हैं this, चेनिंग सक्षम करना:
| Enumerations | Enumerations | Enumerations |
|---|---|---|
setTranslation(double tx, double ty, double tz) | double, double, double | स्थिति सेट करें।. |
setScale(double sx, double sy, double sz) | double, double, double | स्केल सेट करें।. |
setEulerAngles(double rx, double ry, double rz) | double, double, double | डिग्री में रोटेशन सेट करें।. |
setRotation(double rx, double ry, double rz, double rw) | double, double, double, double | रोटेशन को क्वाटरनियन (x, y, z, w) के रूप में सेट करें।. |
setPreRotation(double rx, double ry, double rz) | double, double, double | डिग्री में प्री-रोटेशन सेट करें।. |
setPostRotation(double rx, double ry, double rz) | double, double, double | डिग्री में पोस्ट-रोटेशन सेट करें।. |
setGeometricTranslation(double x, double y, double z) | double, double, double | ज्यामितीय ट्रांसलेशन सेट करें।. |
setGeometricScaling(double sx, double sy, double sz) | double, double, double | ज्यामितीय स्केल सेट करें।. |
setGeometricRotation(double rx, double ry, double rz) | double, double, double | डिग्री में ज्यामितीय रोटेशन सेट करें।. |
उपयोग उदाहरण
एक नोड की स्थिति निर्धारित करें
import com.aspose.threed.Scene;
import com.aspose.threed.*;
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("box");
// Using fluent setters
node.getTransform().setTranslation(5.0, 0.0, -3.0);
// Or via property setter
node.getTransform().setTranslation(new Vector3(5.0, 0.0, -3.0));यूलेर कोणों से घुमाएँ
import com.aspose.threed.Scene;
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("rotated");
// Rotate 45 degrees around Y axis
node.getTransform().setEulerAngles(0.0, 45.0, 0.0);
// Chain multiple operations
node.getTransform()
.setTranslation(2.0, 0.0, 0.0)
.setScale(2.0, 2.0, 2.0);क्वाटरनियन से घुमाएँ
import com.aspose.threed.Scene;
import com.aspose.threed.*;
import com.aspose.threed.*;
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("q-rotated");
// 90 degrees rotation around the Y axis
double halfAngle = Math.toRadians(45); // half the total rotation
Quaternion q = new Quaternion(Math.cos(halfAngle), 0.0, Math.sin(halfAngle), 0.0);
node.getTransform().setRotation(q);
System.out.println("Euler: " + node.getTransform().getEulerAngles()); // synced automaticallyस्केल और स्थिति को साथ में सेट करें
import com.aspose.threed.Scene;
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("big-offset");
node.getTransform()
.setTranslation(10.0, 0.0, 0.0)
.setScale(3.0, 3.0, 3.0)
.setEulerAngles(0.0, 90.0, 0.0);ज्यामितीय ऑफ़सेट (पिवट ऑफ़सेट)
ज्यामितीय ट्रांसफ़ॉर्म नोड के पिवट के सापेक्ष ज्यामिति को शिफ्ट करते हैं बिना चाइल्ड नोड्स को प्रभावित किए; यह मेष को उसके नोड के भीतर केंद्रित करने में उपयोगी है:
import com.aspose.threed.Scene;
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("centered-mesh");
// Shift the mesh half a unit down so its base sits at y=0
node.getTransform().setGeometricTranslation(0.0, -0.5, 0.0);संयुक्त Transform मैट्रिक्स पढ़ें
import com.aspose.threed.Scene;
import com.aspose.threed.*;
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("m");
node.getTransform().setTranslation(1.0, 2.0, 3.0);
node.getTransform().setEulerAngles(0.0, 45.0, 0.0);
Matrix4 m = node.getTransform().getTransformMatrix();
System.out.println(m.getClass().getName()); // com.aspose.threed.Matrix4