コード例 #1
0
ファイル: Camera.cs プロジェクト: karayakar/VirtualCamera
        /// <summary>
        /// Rotation matrix for OZ.
        /// </summary>
        /// <param name="angle">Rotation angle in degrees</param>
        /// <returns>OZ rotation matrix</returns>
        private Matrix4x4 BuildRotationZMatrix(float angle)
        {
            Matrix4x4 rotationZ = Matrix4x4.Identity;
            float     rad       = MathExtension.ToRadians(angle);
            float     cos       = (float)Math.Cos(rad);
            float     sin       = (float)Math.Sin(rad);

            rotationZ.M11 = cos;
            rotationZ.M12 = -sin;
            rotationZ.M21 = sin;
            rotationZ.M22 = cos;

            return(rotationZ);
        }
コード例 #2
0
ファイル: Camera.cs プロジェクト: karayakar/VirtualCamera
        /// <summary>
        /// Rotation matrix for OX.
        /// </summary>
        /// <param name="angle">Rotation angle in degrees</param>
        /// <returns>OX rotation matrix</returns>
        private Matrix4x4 BuildRotationXMatrix(float angle)
        {
            Matrix4x4 rotationX = Matrix4x4.Identity;
            float     rad       = MathExtension.ToRadians(angle);
            float     cos       = (float)Math.Cos(rad);
            float     sin       = (float)Math.Sin(rad);

            rotationX.M22 = cos;
            rotationX.M23 = -sin;
            rotationX.M32 = sin;
            rotationX.M33 = cos;

            return(rotationX);
        }
コード例 #3
0
ファイル: Camera.cs プロジェクト: karayakar/VirtualCamera
        /// <summary>
        /// Rotation matrix for OY.
        /// </summary>
        /// <param name="angle">Rotation angle in degrees</param>
        /// <returns>OY rotation matrix</returns>
        private Matrix4x4 BuildRotationYMatrix(float angle)
        {
            Matrix4x4 rotationY = Matrix4x4.Identity;
            float     rad       = MathExtension.ToRadians(angle);
            float     cos       = (float)Math.Cos(rad);
            float     sin       = (float)Math.Sin(rad);

            rotationY.M11 = cos;
            rotationY.M13 = sin;
            rotationY.M31 = -sin;
            rotationY.M33 = cos;

            return(rotationY);
        }