■ 두 벡터의 각도 구하기

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

using System;

using System.Windows.Media.Media3D;

 

#region 각도 구하기 - GetAngle(vector1, vector2)

 

/// <summary>

/// 각도 구하기

/// </summary>

/// <param name="vector1">벡터 1</param>

/// <param name="vector2">벡터 2</param>

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

public double GetAngle(Vector3D vector1, Vector3D vector2)

{

    return 180d / Math.PI * Math.Acos(Vector3D.DotProduct(vector1, vector2) / (vector1.Length * vector2.Length));

}

 

#endregion

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

Posted by 사용자 icodebroker
TAG