Vector.AngleBetween Method (Vector, Vector)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Retrieves the angle, expressed in degrees, between the two specified vectors.

Namespace:   System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

public static double AngleBetween(
	Vector vector1,
	Vector vector2
)

Parameters

vector1
Type: System.Windows.Vector

The first vector to evaluate.

vector2
Type: System.Windows.Vector

The second vector to evaluate.

Return Value

Type: System.Double

The angle, in degrees, between vector1 and vector2.

The following example shows how to use this method to get the angle between two Vector structures.

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;

}

.NET Framework
Available since 3.0
Return to top
Show: