Vector3D.AngleBetween Method (Vector3D, Vector3D)

 

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
Available since 3.0
Return to top
Show: