This documentation is archived and is not being maintained.

Vector3D Structure

Represents a displacement in 3-D space.

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

public struct Vector3D : IFormattable
/** @attribute SerializableAttribute() */ 
/** @attribute TypeConverterAttribute(System.Windows.Media.Media3D.Vector3DConverter) */ 
public final class Vector3D extends ValueType implements IFormattable
<object property="x,y,z"/>
 x   System.Double  The X component of this Vector3D structure.  y   System.Double  The Y component of this Vector3D structure.  z   System.Double  The Z component of this Vector3D structure. 

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)

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0