You can write code here to use Aspose.3D and run the code in browser to see how it works.
Step 4 of 4: The following code demonstrates how to rotate a geometric object using a quaternion q3.
using Aspose.ThreeD;
using Aspose.ThreeD.Entities;
using Aspose.ThreeD.Utilities;

//Create a new 3D scene
Scene scene = new Scene();

//Create quaternion q1
Quaternion q1 = Quaternion.FromEulerAngle(Math.PI * 0.5, 0, 0);

//Create quaternion q2
Quaternion q2 = Quaternion.FromAngleAxis(-Math.PI * 0.5, Vector3.XAxis);

//Concatenate q1 and q2. q1 and q2 rotate alone x-axis with same angle but differentdirection,So the concatenated result will be identity quaternion.
Quaternion q3 = q1.Concat(q2);

// Create a cylinder to represent q1 quaternion
Node cylinder = scene.RootNode.CreateChildNode("cylinder-q1", new Cylinder(0.1, 1, 2));
cylinder.Transform.Rotation = q1;
cylinder.Transform.Translation = new Vector3(-5, 2, 0);

// Create a cylinder to represent q2 quaternion
cylinder = scene.RootNode.CreateChildNode("cylinder-q2", new Cylinder(0.1, 1, 2));
cylinder.Transform.Rotation = q2;
cylinder.Transform.Translation = new Vector3(0, 2, 0);

// Create a cylinder to represent q3 quaternion
cylinder = scene.RootNode.CreateChildNode("cylinder-q3", new Cylinder(0.1, 1, 2));
cylinder.Transform.Rotation = q3;
cylinder.Transform.Translation = new Vector3(5, 0, 0);

scene