Vector3D.AngleBetween(Vector3D, Vector3D) Method

Definition

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

C#
public static double AngleBetween(System.Windows.Media.Media3D.Vector3D vector1, System.Windows.Media.Media3D.Vector3D vector2);

Parameters

vector1
Vector3D

The first Vector3D structure to evaluate.

vector2
Vector3D

The second Vector3D structure to evaluate.

Returns

The angle in degrees needed to rotate vector1 into vector2.

Examples

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

C#
                    // 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

Remarks

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

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10