Vector3D.UnaryNegation Operator (Vector3D)


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

Negates a Vector3D structure.

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

public static Vector3D operator -(
	Vector3D vector


Type: System.Windows.Media.Media3D.Vector3D

The Vector3D structure to negate.

Return Value

Type: System.Windows.Media.Media3D.Vector3D

A Vector3D structure with X, Y, and Z values opposite of the X, Y, and Z values of vector.

The returned Vector3D structure has the same magnitude (Length) as vector but its direction is opposite of that of vector.

The following example shows how to use the overloaded negation operator to negate a Vector3D structure.

// Negates a Vector3D using the overloaded unary negation operator.

Vector3D vector1 = new Vector3D(20, 30, 40);
Vector3D vectorResult = new Vector3D();

vectorResult = -vector1;
// vectorResult is equal to (-20, -30, -40)

.NET Framework
Available since 3.0
Return to top