コード例 #1
0
        /// <summary>
        /// 旋转矩阵,逆时针旋转angle
        /// </summary>
        /// <param name="angle">旋转角度</param>
        /// <returns></returns>
        public static Matrix2x2 RotateMatrix(double angle)
        {
            double  cosAngle = MathFunc.cosAngle(angle);
            double  sinAngle = MathFunc.sinAngle(angle);
            Double2 col1     = new Double2(cosAngle, sinAngle);
            Double2 col2     = new Double2(-sinAngle, cosAngle);

            return(new Matrix2x2(col1, col2));
        }
コード例 #2
0
        /// <summary>
        /// 求角度
        /// </summary>
        /// <returns></returns>
        public double GetAngle()
        {
            double len = magnitude;

            if (len == 0)
            {
                return(0);
            }
            double sinValue = this.y / len;
            double cosValue = this.x / len;

            return(MathFunc.GetAngle(cosValue, sinValue));
        }
コード例 #3
0
        /// <summary>
        /// 指数函数
        /// </summary>
        /// <param name="n"></param>
        /// <returns></returns>
        public Complex Exp(double n)
        {
            double len   = this.magnitude;
            double angle = this.GetAngle();

            if (len == 0)
            {
                return(zero);
            }
            len    = System.Math.Pow(len, n);
            angle *= n;
            return(new Complex(len * MathFunc.cosAngle(angle), len * MathFunc.sinAngle(angle)));
        }