本文整理汇总了C#中ScriptCoreLib.rotate方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptCoreLib.rotate方法的具体用法?C# ScriptCoreLib.rotate怎么用?C# ScriptCoreLib.rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScriptCoreLib
的用法示例。
在下文中一共展示了ScriptCoreLib.rotate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Application
//.........这里部分代码省略.........
if (output == that)
{
that[12] = output[0] * xx + output[4] * y + output[8] * z + output[12];
that[13] = output[1] * xx + output[5] * y + output[9] * z + output[13];
that[14] = output[2] * xx + output[6] * y + output[10] * z + output[14];
that[15] = output[3] * xx + output[7] * y + output[11] * z + output[15];
return that;
}
float a00, a01, a02, a03,
a10, a11, a12, a13,
a20, a21, a22, a23;
a00 = output[0]; a01 = output[1]; a02 = output[2]; a03 = output[3];
a10 = output[4]; a11 = output[5]; a12 = output[6]; a13 = output[7];
a20 = output[8]; a21 = output[9]; a22 = output[10]; a23 = output[11];
that[0] = a00; that[1] = a01; that[2] = a02; that[3] = a03;
that[4] = a10; that[5] = a11; that[6] = a12; that[7] = a13;
that[8] = a20; that[9] = a21; that[10] = a22; that[11] = a23;
that[12] = a00 * xx + a10 * y + a20 * z + output[12];
that[13] = a01 * xx + a11 * y + a21 * z + output[13];
that[14] = a02 * xx + a12 * y + a22 * z + output[14];
that[15] = a03 * xx + a13 * y + a23 * z + output[15];
return that;
}
),
rotate = new Func<float[], float[], float, float[], float[]>(
(that, a, rad, axis) =>
{
float x = axis[0], y = axis[1], z = axis[2];
float len = (float)Math.Sqrt(x * x + y * y + z * z),
s, c, t,
a00, a01, a02, a03,
a10, a11, a12, a13,
a20, a21, a22, a23,
b00, b01, b02,
b10, b11, b12,
b20, b21, b22;
if (Math.Abs(len) < float.Epsilon)
return that;
len = 1f / len;
x *= len;
y *= len;
z *= len;
s = (float)Math.Sin(rad);
c = (float)Math.Cos(rad);
t = 1 - c;
a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];
a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];
a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];
// Construct the elements of the rotation matrix
b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;
b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;