This documentation is archived and is not being maintained.

Vector3D.AngleBetween Method

Retrieves the angle required to rotate the first specified Vector3D structure into the second specified Vector3D structure.

Namespace:  System.Windows.Media.Media3D
Assembly:  PresentationCore (in PresentationCore.dll)

public static double AngleBetween(
	Vector3D vector1,
	Vector3D vector2
)

Parameters

vector1
Type: System.Windows.Media.Media3D.Vector3D
The first Vector3D structure to evaluate.
vector2
Type: System.Windows.Media.Media3D.Vector3D
The second Vector3D structure to evaluate.

Return Value

Type: System.Double
The angle in degrees needed to rotate vector1 into vector2.

Signed angles do not extend into 3-D space, so an angle between 0 and 180 degrees is returned.

The following example shows how to get the angle between two Vector3D structures.


						// Calculates the angle between two Vector3Ds using the static AngleBetween method. 
						// Returns a Double.
	
                        Vector3D vector1 = new Vector3D(20, 30, 40);
                        Vector3D vector2 = new Vector3D(45, 70, 80);
                        Double angleBetween;

						angleBetween = Vector3D.AngleBetween(vector1, vector2 );
                        // angleBetween is approximately equal to 4.15129


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: