■ 두 벡터의 외적 구하기

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

using System.Windows.Media.Media3D;

 

#region 외적 구하기 - GetCrossProduct(vector1, vector2)


/// <summary>

/// 외적 구하기

/// </summary>

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

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

/// <returns>외적</returns>

public Vector3D GetCrossProduct(Vector3D vector1, Vector3D vector2)

{

    return new Vector3D

    (

        vector1.Y * vector2.Z - vector1.Z * vector2.Y,

        vector1.Z * vector2.X - vector1.X * vector2.Z,

        vector1.X * vector2.Y - vector1.Y * vector2.X

    );

}

 

#endregion

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

Posted by 사용자 icodebroker
TAG