共用方式為


Vector.AngleBetween(Vector, Vector) 方法

定義

擷取兩個所指定向量之間的角度 (以度數表示)。

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

要評估的第二個向量。

傳回

Double

vector1vector2 之間的角度 (以度數為單位)。

範例

下列範例示範如何使用這個方法來取得兩 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;
}

適用於