Quaternion — Aspose.3D FOSS for Java

Methods

Quaternion repräsentiert ein Einheitsquaternion, das für Rotationen verwendet wird. Es vermeidet Gimbal-Lock und ermöglicht eine sanfte Interpolation zwischen Orientierungen. Das Transform Klasse speichert die Rotation als ein Quaternion zugänglich über getRotation() / setRotation().

Methods: com.aspose.threed

import com.aspose.threed.*;

Methods

MethodsMethods
Quaternion()Identitätsquaternion (1, 0, 0, 0)
Quaternion(double w, double x, double y, double z)Konstruiert aus vier Komponenten

Öffentliche Felder

Quaternion verwendet öffentliche Felder für den Zugriff auf Komponenten (keine Getter/Setter-Methoden):

MethodsMethodsMethodsMethods
wdoubleq.wSkalar (reeller) Teil
xdoubleq.xX‑Komponente des Vektorteils
ydoubleq.yY‑Komponente des Vektorteils
zdoubleq.zZ‑Komponente des Vektorteils

Berechnete Eigenschaften

MethodsMethodsMethodsMethods
lengthdoublegetLength()Betrag des Quaternion (sollte sein 1.0 für ein Einheitsquaternion)

Statische Felder

MethodsMethodsMethods
IDENTITYQuaternionDas Identitätsquaternion (1, 0, 0, 0) – keine Rotation

Statische Methoden

MethodsRückgabetypMethods
Quaternion.fromEuler(double x, double y, double z)QuaternionErstellt ein Quaternion aus Euler‑Winkeln in Grad
Quaternion.fromAngleAxis(double angle, Vector3 axis)QuaternionErstellt ein Quaternion aus einem Winkel (Radiant) und einer Rotationsachse

Instanzmethoden

MethodsRückgabetypMethods
normalize()QuaternionGibt eine Kopie mit Einheitslänge zurück
conjugate()QuaternionGibt das Konjugierte zurück (negierter Vektoranteil)
inverse()QuaternionGibt das multiplikative Inverse zurück
toEulerAngles()Vector3Konvertiert zu Euler-Winkeln in Grad
toMatrix()Matrix4Konvertiert zu einer 4x4-Rotationsmatrix

Methods

import com.aspose.threed.Scene;
import com.aspose.threed.Node;
import com.aspose.threed.*;

Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("rotated");

// Create from Euler angles (degrees)
Quaternion q = Quaternion.fromEuler(0.0, 90.0, 0.0);
node.getTransform().setRotation(q);

// Read back as Euler
Vector3 euler = node.getTransform().getEulerAngles();
System.out.println(euler);   // approximately (0, 90, 0)

// Create from angle-axis
Quaternion q2 = Quaternion.fromAngleAxis(Math.toRadians(45), Vector3.UNIT_Y);
node.getTransform().setRotation(q2);

// Combine rotations via multiply
Quaternion start = Quaternion.IDENTITY;
Quaternion end = Quaternion.fromEuler(0.0, 180.0, 0.0);
Quaternion combined = Quaternion.multiply(start, end);

Siehe auch

 Deutsch