本文整理汇总了C#中Quaternion.GetMagnitude方法的典型用法代码示例。如果您正苦于以下问题:C# Quaternion.GetMagnitude方法的具体用法?C# Quaternion.GetMagnitude怎么用?C# Quaternion.GetMagnitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quaternion
的用法示例。
在下文中一共展示了Quaternion.GetMagnitude方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QuaternionMath
static void QuaternionMath()
{
//Collect user input, All units are arbitrary
Console.Write("Enter a scalar value: ");
float scalar = Convert.ToSingle(Console.ReadLine());
Console.WriteLine("Enter the first quaternion:");
Console.Write("Scalar component: ");
float w = Convert.ToSingle(Console.ReadLine());
Console.Write("Vector-x component: ");
float x = Convert.ToSingle(Console.ReadLine());
Console.Write("Vector-y component: ");
float y = Convert.ToSingle(Console.ReadLine());
Console.Write("Vector-z component: ");
float z = Convert.ToSingle(Console.ReadLine());
Quaternion first = new Quaternion(w, x, y, z);
Console.WriteLine("Enter the second quaternion:");
Console.Write("Scalar component: ");
w = Convert.ToSingle(Console.ReadLine());
Console.Write("Vector-x component: ");
x = Convert.ToSingle(Console.ReadLine());
Console.Write("Vector-y component: ");
y = Convert.ToSingle(Console.ReadLine());
Console.Write("Vector-z component: ");
z = Convert.ToSingle(Console.ReadLine());
Quaternion second = new Quaternion(w, x, y, z);
//Display output
Console.WriteLine("Sum: " + (first + second));
Console.WriteLine("Difference: " + (first - second));
Console.WriteLine("Scalar multiplication: " + (scalar * first) + " and " + (scalar * second));
Console.WriteLine("Quaternion multipliation: " + (first * second));
Console.WriteLine("Magnitudes: " + first.GetMagnitude() + " and " + second.GetMagnitude());
Console.WriteLine("Conjugates: " + first.GetConjugate() + " and " + second.GetConjugate());
Console.WriteLine("Inverses: " + first.GetInverse() + " and " + second.GetInverse());
}