コード例 #1
0
        /// <summary>
        /// Gets the angle of the Line, in radians or degrees.
        /// </summary>
        /// <returns>A float of the angle the Line is pointing, in radians or degrees.</returns>
        public float GetLineAngle(bool inDegrees)
        {
            Vector2 point1 = P1.ToVector2();
            Vector2 point2 = P2.ToVector2();

            double radians = Math.Atan2(point2.Y - point1.Y, point2.X - point1.X);

            if (inDegrees == false)
            {
                return((float)radians);
            }

            double degrees = UtilityGlobals.ToDegrees(radians);

            return((float)degrees);
        }