Cos() public static method

public static Cos ( float radians ) : float
radians float
return float
Ejemplo n.º 1
0
        /// <summary>
        /// Returns a matrix that can be used to rotate a set of points around the z-axis.
        /// </summary>
        /// <param name="radians">The amount, in radians, in which to rotate around the z-axis.</param>
        /// <returns>The created rotation matrix.</returns>
        public static Matrix3D CreateRotationZ(float radians)
        {
            float s = MathUtility.Sin(radians);
            float c = MathUtility.Cos(radians);

            return(new Matrix3D(
                       c, s, 0, 0,
                       -s, c, 0, 0,
                       0, 0, 1, 0,
                       0, 0, 0, 1));
        }
Ejemplo n.º 2
0
        public Quaternion(Vector3D axis, float angle)
        {
            axis.Normalize();
            float num2 = angle * 0.5f;
            float num  = MathUtility.Sin(num2);
            float num3 = MathUtility.Cos(num2);

            X = axis.X * num;
            Y = axis.Y * num;
            Z = axis.Z * num;
            W = num3;
        }
Ejemplo n.º 3
0
        public static Quaternion CreateFromAxisAngle(Vector3D axis, float angle)
        {
            Quaternion quaternion;
            float      num2 = angle * 0.5f;
            float      num  = MathUtility.Sin(num2);
            float      num3 = MathUtility.Cos(num2);

            quaternion.X = axis.X * num;
            quaternion.Y = axis.Y * num;
            quaternion.Z = axis.Z * num;
            quaternion.W = num3;
            return(quaternion);
        }
Ejemplo n.º 4
0
        public static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll)
        {
            Quaternion quaternion;
            float      num9 = roll * 0.5f;
            float      num6 = MathUtility.Sin(num9);
            float      num5 = MathUtility.Cos(num9);
            float      num8 = pitch * 0.5f;
            float      num4 = MathUtility.Sin(num8);
            float      num3 = MathUtility.Cos(num8);
            float      num7 = yaw * 0.5f;
            float      num2 = MathUtility.Sin(num7);
            float      num  = MathUtility.Cos(num7);

            quaternion.X = ((num * num4) * num5) + ((num2 * num3) * num6);
            quaternion.Y = ((num2 * num3) * num5) - ((num * num4) * num6);
            quaternion.Z = ((num * num3) * num6) - ((num2 * num4) * num5);
            quaternion.W = ((num * num3) * num5) + ((num2 * num4) * num6);
            return(quaternion);
        }