Vector.AngleBetween(Vector, Vector) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
擷取兩個所指定向量之間的角度 (以度數表示)。
public:
static double AngleBetween(System::Windows::Vector vector1, System::Windows::Vector vector2);
public static double AngleBetween (System.Windows.Vector vector1, System.Windows.Vector vector2);
static member AngleBetween : System.Windows.Vector * System.Windows.Vector -> double
Public Shared Function AngleBetween (vector1 As Vector, vector2 As Vector) As Double
參數
- vector1
- Vector
要評估的第一個向量。
- vector2
- Vector
要評估的第二個向量。
傳回
vector1
與 vector2
之間的角度 (以度數為單位)。
範例
下列範例示範如何使用這個方法來取得兩 Vector 個結構之間的角度。
private Double angleBetweenExample()
{
Vector vector1 = new Vector(20, 30);
Vector vector2 = new Vector(45, 70);
Double angleBetween;
// angleBetween is approximately equal to 0.9548
angleBetween = Vector.AngleBetween(vector1, vector2);
return angleBetween;
}