Vector3D Structure
Represents a displacement in 3-D space.
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
This example shows how to subtract Vector3D structures using the overloaded subtraction (-) operator and the Vector3D static Subtract method.
The following code shows how to use the Vector3D subtraction methods. First, the Vector3D structures are instantiated. The Vector3D structures are subtracted using the overloaded (-) operator, and then they are subtracted using the static Subtract method.
// Subtracts two 3-D Vectors using the Subtract method and - // Declaring vector1 and initializing x,y,z values Vector3D vector1 = new Vector3D(20, 30, 40); // Declaring vector2 without initializing x,y,z values Vector3D vector2 = new Vector3D(); // Assigning values to vector2 vector2.X = 45; vector2.Y = 70; vector2.Z = 80; // Subtracting vectors using overload - operator Vector3D vectorResult1 = new Vector3D(); vectorResult1 = vector1 - vector2; // vectorResult1 is equal to (-25, -40, -40) // Subtracting vectors using static Subtract method Vector3D vectorResult2 = new Vector3D(); vectorResult2 = Vector3D.Subtract(vector1, vector2); // vector2 is equal to (-25, -40, -40)
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.