コード例 #1
0
ファイル: TSVector.cs プロジェクト: tangeping/SurvivalShooter
        /// <summary>
        /// Normalizes the given vector.
        /// </summary>
        /// <param name="value">The vector which should be normalized.</param>
        /// <returns>A normalized vector.</returns>
        #region public static JVector Normalize(JVector value)
        public static TSVector Normalize(TSVector value)
        {
            TSVector result;

            TSVector.Normalize(ref value, out result);
            return(result);
        }
コード例 #2
0
        public static TSQuaternion AngleAxis(FP angle, TSVector axis)
        {
            axis = axis * FP.Deg2Rad;
            axis.Normalize();

            FP halfAngle = angle * FP.Deg2Rad * FP.Half;

            TSQuaternion rotation;
            FP           sin = FP.Sin(halfAngle);

            rotation.x = axis.x * sin;
            rotation.y = axis.y * sin;
            rotation.z = axis.z * sin;
            rotation.w = FP.Cos(halfAngle);

            return(rotation);
        }