public void TestCos() { for (Double deg = -360.0; deg <= 360.0; deg += 0.1) { Double rad = deg * DoublePrecision.Maths.Deg2Rad; Fixed64 f = rad; Fixed64 fs = Fixed64.Cos(f); Double result = fs.ToDouble(); Double expected = Math.Cos(rad); Assert.That(result, Is.EqualTo(expected).Within(MathsTests.TestTolerance). // Check that result is within test tolerance for Fixed64 Or.EqualTo(expected).Within(MathsTests.PercentageTolerance * Math.Abs(result))); // or that result is within test percentage for Fixed64. } }
public static void CreateRotationZ(Fixed64 radians, out Fixed64Matrix result) { Fixed64 num2 = Fixed64.Cos(radians); Fixed64 num = Fixed64.Sin(radians); result.M11 = num2; result.M12 = num; result.M13 = Fixed64.Zero; result.M21 = -num; result.M22 = num2; result.M23 = Fixed64.Zero; result.M31 = Fixed64.Zero; result.M32 = Fixed64.Zero; result.M33 = Fixed64.One; }
public static Fixed64Matrix CreateRotationZ(Fixed64 radians) { Fixed64Matrix matrix; Fixed64 num2 = Fixed64.Cos(radians); Fixed64 num = Fixed64.Sin(radians); matrix.M11 = num2; matrix.M12 = num; matrix.M13 = Fixed64.Zero; matrix.M21 = -num; matrix.M22 = num2; matrix.M23 = Fixed64.Zero; matrix.M31 = Fixed64.Zero; matrix.M32 = Fixed64.Zero; matrix.M33 = Fixed64.One; return(matrix); }
/// <summary> /// Creates a matrix which rotates around the given axis by the given angle. /// </summary> /// <param name="axis">The axis.</param> /// <param name="angle">The angle.</param> /// <param name="result">The resulting rotation matrix</param> public static void CreateFromAxisAngle(ref Fixed64Vector3 axis, Fixed64 angle, out Fixed64Matrix result) { Fixed64 x = axis.x; Fixed64 y = axis.y; Fixed64 z = axis.z; Fixed64 num2 = Fixed64.Sin(angle); Fixed64 num = Fixed64.Cos(angle); Fixed64 num11 = x * x; Fixed64 num10 = y * y; Fixed64 num9 = z * z; Fixed64 num8 = x * y; Fixed64 num7 = x * z; Fixed64 num6 = y * z; result.M11 = num11 + (num * (Fixed64.One - num11)); result.M12 = (num8 - (num * num8)) + (num2 * z); result.M13 = (num7 - (num * num7)) - (num2 * y); result.M21 = (num8 - (num * num8)) - (num2 * z); result.M22 = num10 + (num * (Fixed64.One - num10)); result.M23 = (num6 - (num * num6)) + (num2 * x); result.M31 = (num7 - (num * num7)) + (num2 * y); result.M32 = (num6 - (num * num6)) - (num2 * x); result.M33 = num9 + (num * (Fixed64.One - num9)); }
public static F64Vec4 Cos(F64Vec4 a) { return(new F64Vec4(Fixed64.Cos(a.RawX), Fixed64.Cos(a.RawY), Fixed64.Cos(a.RawZ), Fixed64.Cos(a.RawW))); }
public static F64Vec3 Cos(F64Vec3 a) { return(new F64Vec3(Fixed64.Cos(a.RawX), Fixed64.Cos(a.RawY), Fixed64.Cos(a.RawZ))); }
/// <summary> /// Returns the cosine of value. /// </summary> public static Fixed64 Cos(Fixed64 value) { return(Fixed64.Cos(value)); }
public static F64 Cos(F64 a) { return(FromRaw(Fixed64.Cos(a.Raw))); }
public static F64Vec2 Cos(F64Vec2 a) { return(new F64Vec2(Fixed64.Cos(a.RawX), Fixed64.Cos(a.RawY))); }