Ejemplo n.º 1
0
        /// <summary>
        /// Gets the X angle between two vectors
        /// </summary>
        /// <param name="vecA"></param>
        /// <returns></returns>
        public double GetAngleX()
        {
            var vx = new ASVECTOR2(1, 0);
            var vn = new ASVECTOR2(this);

            vn.Normalise();

            double angle = Math.Acos(vx.ScalarProduct(vn));

            if (vn.y < 0)
            {
                return(Math.PI * 2.0 - angle);
            }

            return(angle);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the Y angle between two vectors
        /// </summary>
        /// <param name="vecA"></param>
        /// <returns></returns>
        public double GetAngleY()
        {
            var vy = new ASVECTOR2(0, 1);
            var vn = new ASVECTOR2(this);

            vn.Normalise();

            double angle = Math.Acos(vy.ScalarProduct(vn));

            if (vn.x > 0)
            {
                return(Math.PI * 2.0 - angle);
            }

            return(angle);
        }