■ Math 클래스 : 각도 구하기

----------------------------------------------------------------------------------------------------

 

using System;

 

#region 각도 구하기 - GetAngle(startX, startY, endX, endY)

 

/// <summary>

/// 각도 구하기

/// </summary>

/// <param name="startX">시작 X</param>

/// <param name="startY">시작 Y</param>

/// <param name="endX">종료 X</param>

/// <param name="endY">종료 Y</param>

/// <returns>각도</returns>

public double GetAngle(double startX, double startY, double endX, double endY)

{

    double deltaX = endX - startX;

    double deltaY = endY - startY;

 

    return Math.Atan2(deltaY, deltaX) * (180d / Math.PI);

}

 

#endregion

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요