本文整理汇总了C#中Vector4D.Dot方法的典型用法代码示例。如果您正苦于以下问题:C# Vector4D.Dot方法的具体用法?C# Vector4D.Dot怎么用?C# Vector4D.Dot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector4D
的用法示例。
在下文中一共展示了Vector4D.Dot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QuatToMatrix4d
private Matrix4D QuatToMatrix4d(Vector4D q)
{
double n = q.Dot(q);
double s = (n > 0.0) ? (2.0 / n) : 0.0f;
double xs, ys, zs;
double wx, wy, wz;
double xx, xy, xz;
double yy, yz, zz;
xs = q.x * s; ys = q.y * s; zs = q.z * s;
wx = q.w * xs; wy = q.w * ys; wz = q.w * zs;
xx = q.x * xs; xy = q.x * ys; xz = q.x * zs;
yy = q.y * ys; yz = q.y * zs; zz = q.z * zs;
Matrix4D m = new Matrix4D();
m[0, 0] = 1.0 - (yy + zz); m[1, 0] = xy - wz; m[2, 0] = xz + wy;
m[0, 1] = xy + wz; m[1, 1] = 1.0 - (xx + zz); m[2, 1] = yz - wx;
m[0, 2] = xz - wy; m[1, 2] = yz + wx; m[2, 2] = 1.0 - (xx + yy);
m[3, 3] = 1.0;
return m;
}
示例2: Dot
public void Dot()
{
Vector4D a = new Vector4D(1.0, 2.0, 3.0, 4.0);
Vector4D b = new Vector4D(4.0, 5.0, 6.0, 7.0);
double dot = a.Dot(b);
Assert.AreEqual(1.0 * 4.0 + 2.0 * 5.0 + 3.0 * 6.0 + 4.0 * 7.0, dot, 1e-14);
}