Point3D.Subtraction Operator (Point3D, Point3D)


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

Subtracts a Point3D structure from a Point3D structure and returns the result as a Vector3D structure.

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

public static Vector3D operator -(
	Point3D point1,
	Point3D point2


Type: System.Windows.Media.Media3D.Point3D

The Point3D structure on which to perform subtraction.

Type: System.Windows.Media.Media3D.Point3D

The Point3D structure to subtract from point1.

Return Value

Type: System.Windows.Media.Media3D.Vector3D

A Vector3D structure that represents the difference between point1 and point2.

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

                  // Subtracts a Point3D from a Point3D using the overloaded - operator.
                  // Returns a Vector3D.

                  Point3D point1 = new Point3D(10, 5, 1);
                  Point3D point2 = new Point3D(15, 40, 60);
                  Vector3D vectorResult = new Vector3D();

                  vectorResult = point1 - point2;
                  // vectorResult is equal to (-5, -35, -59)

                  // Displaying Results
                  syntaxString = " vectorResult = point1 - point2;";
                  resultType = "Vector3D";
operationString = "Subtracting a Point3D from a Point3D";
ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);

.NET Framework
Available since 3.0
Return to top