Exemple #1
0
        /// <summary>
        /// Get the Origin Direction of a Cone
        /// </summary>
        /// <param name="origin"></param>
        /// <param name="position"></param>
        /// <returns></returns>
        private static Direction GetConeOriginDirection(Vector3 origin, Vector3 position)
        {
            float angle = MathUtility.AngleInDegrees(origin, position);

            if (angle <= 90)
            {
                return(Direction.NorthEast);
            }
            else if (angle > 90 && angle <= 180)
            {
                return(Direction.NorthWest);
            }
            else if (angle > 180 && angle <= 270)
            {
                return(Direction.SouthWest);
            }
            else
            {
                return(Direction.SouthEast);
            }
        }
Exemple #2
0
        /// <summary>
        /// Get the Direction of a Point with respect to another point
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="origin"></param>
        /// <param name="reference"></param>
        /// <returns></returns>
        private static Direction GetConeDirection(Vector3 origin, Vector3 position)
        {
            float angle = MathUtility.AngleInDegrees(origin, position);

            if (angle <= 30 || angle > 330)
            {
                return(Direction.East);
            }
            else if (angle > 30 && angle <= 60)
            {
                return(Direction.NorthEast);
            }
            else if (angle > 60 && angle <= 120)
            {
                return(Direction.North);
            }
            else if (angle > 120 && angle <= 150)
            {
                return(Direction.NorthWest);
            }
            else if (angle > 150 && angle <= 210)
            {
                return(Direction.West);
            }
            else if (angle > 210 && angle <= 240)
            {
                return(Direction.SouthWest);
            }
            else if (angle > 240 && angle <= 300)
            {
                return(Direction.South);
            }
            else
            {
                return(Direction.SouthEast);
            }
        }