# Vector3D.Subtraction Operator

## Definition

Important

Some information relates to prerelease product that may be substantially modified before itâ€™s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

## Overloads

Subtraction(Vector3D, Vector3D) | |

Subtraction(Vector3D, Point3D) |

## Subtraction(Vector3D, Vector3D)

```
public:
static System::Windows::Media::Media3D::Vector3D operator -(System::Windows::Media::Media3D::Vector3D vector1, System::Windows::Media::Media3D::Vector3D vector2);
```

`public static System.Windows.Media.Media3D.Vector3D operator - (System.Windows.Media.Media3D.Vector3D vector1, System.Windows.Media.Media3D.Vector3D vector2);`

`static member ( - ) : System.Windows.Media.Media3D.Vector3D * System.Windows.Media.Media3D.Vector3D -> System.Windows.Media.Media3D.Vector3D`

`Public Shared Operator - (vector1 As Vector3D, vector2 As Vector3D) As Vector3D`

#### Parameters

#### Returns

The result of subtracting `vector2`

from `vector1`

.

### Examples

The following example shows how to use the overloaded subtraction operator to subtract a Vector3D structure from a Vector3D structure.

```
// Subtracts a Vector3D from a Vector3D using the overloaded - operator.
// Returns a Vector3D.
Vector3D vector1 = new Vector3D(20, 30, 40);
Vector3D vector2 = new Vector3D(45, 70, 80);
Vector3D vectorResult = new Vector3D();
vectorResult = vector1 - vector2;
// vector Result is equal to (-25, -40, -40)
```

```
' Subtracts a Vector3D from a Vector3D using the overloaded - operator.
' Returns a Vector3D.
Dim vector1 As New Vector3D(20, 30, 40)
Dim vector2 As New Vector3D(45, 70, 80)
Dim vectorResult As New Vector3D()
vectorResult = vector1 - vector2
' vector Result is equal to (-25, -40, -40)
```

### See also

### Applies to

## Subtraction(Vector3D, Point3D)

```
public:
static System::Windows::Media::Media3D::Point3D operator -(System::Windows::Media::Media3D::Vector3D vector, System::Windows::Media::Media3D::Point3D point);
```

`public static System.Windows.Media.Media3D.Point3D operator - (System.Windows.Media.Media3D.Vector3D vector, System.Windows.Media.Media3D.Point3D point);`

`static member ( - ) : System.Windows.Media.Media3D.Vector3D * System.Windows.Media.Media3D.Point3D -> System.Windows.Media.Media3D.Point3D`

`Public Shared Operator - (vector As Vector3D, point As Point3D) As Point3D`

#### Parameters

#### Returns

The result of subtracting `point`

from `vector`

.

### Examples

The following example shows how to use the overloaded subtraction operator to subtract a Point3D structure from a Vector3D structure.

```
// Subtracts a Vector3D from a Point3D using the overloaded - operator.
// Returns a Point3D.
Point3D point1 = new Point3D(10, 5, 1);
Vector3D vector1 = new Vector3D(20, 30, 40);
Point3D pointResult = new Point3D();
// Subtracting the vector from the point
pointResult = vector1 - point1;
// pointResult is equal to (10, 25, 39)
```

```
' Subtracts a Vector3D from a Point3D using the overloaded - operator.
' Returns a Point3D.
Dim point1 As New Point3D(10, 5, 1)
Dim vector1 As New Vector3D(20, 30, 40)
Dim pointResult As New Point3D()
' Subtracting the vector from the point
pointResult = vector1 - point1
' pointResult is equal to (10, 25, 39)
```