Vector3D Structure

Represents a displacement in 3-D space.

Namespace:  System.Windows.Media.Media3D
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

[<Sealed>]
[<SerializableAttribute>]
[<TypeConverterAttribute(typeof(Vector3DConverter))>]
type Vector3D =  
    struct 
        interface IFormattable 
    end
<object property="x,y,z"/>
-or
<object property="x y z"/>

XAML Values

x

The X component of this Vector3D structure.

y

The Y component of this Vector3D structure.

z

The Z component of this Vector3D structure.

The Vector3D type exposes the following members.

  NameDescription
Public methodVector3DInitializes a new instance of a Vector3D structure.
Top

  NameDescription
Public propertyLengthGets the length of this Vector3D structure.
Public propertyLengthSquaredGets the square of the length of this Vector3D structure.
Public propertyXGets or sets the X component of this Vector3D structure.
Public propertyYGets or sets the Y component of this Vector3D structure.
Public propertyZGets or sets the Z component of this Vector3D structure.
Top

  NameDescription
Public methodStatic memberAdd(Vector3D, Point3D)Translates the specified Point3D structure by the specified Vector3D structure and returns the result as a Point3D structure.
Public methodStatic memberAdd(Vector3D, Vector3D)Adds two Vector3D structures and returns the result as a Vector3D structure.
Public methodStatic memberAngleBetweenRetrieves the angle required to rotate the first specified Vector3D structure into the second specified Vector3D structure.
Public methodStatic memberCrossProductCalculates the cross product of two Vector3D structures.
Public methodStatic memberDivideDivides the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.
Public methodStatic memberDotProductCalculates the dot product of two Vector3D structures.
Public methodEquals(Object)Determines whether the specified object is a Vector3D structure and whether the X, Y, and Z properties of the specified Object are equal to the X, Y, and Z properties of this Vector3D structure. (Overrides ValueType.Equals(Object).)
Public methodEquals(Vector3D)Compares two Vector3D structures for equality.
Public methodStatic memberEquals(Vector3D, Vector3D)Compares two Vector3D structures for equality.
Public methodGetHashCodeGets a hash code for this Vector3D structure. (Overrides ValueType.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodStatic memberMultiply(Double, Vector3D)Multiplies the specified scalar by the specified Vector3D structure and returns the result as a Vector3D.
Public methodStatic memberMultiply(Vector3D, Double)Multiplies the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.
Public methodStatic memberMultiply(Vector3D, Matrix3D)Transforms the coordinate space of the specified Vector3D structure using the specified Matrix3D structure.
Public methodNegateNegates a Vector3D structure.
Public methodNormalizeNormalizes the specified Vector3D structure.
Public methodStatic memberParseConverts a String representation of a 3-D vector into the equivalent Vector3D structure.
Public methodStatic memberSubtract(Vector3D, Point3D)Subtracts a Point3D structure from a Vector3D structure.
Public methodStatic memberSubtract(Vector3D, Vector3D)Subtracts a Vector3D structure from a Vector3D structure.
Public methodToString()Creates a String representation of this Vector3D structure. (Overrides ValueType.ToString().)
Public methodToString(IFormatProvider)Creates a String representation of this Vector3D structure.
Top

  NameDescription
Public operatorStatic memberAddition(Vector3D, Point3D)Translates the specified Point3D structure by the specified Vector3D structure and returns the result as a Point3D structure.
Public operatorStatic memberAddition(Vector3D, Vector3D)Adds two Vector3D structures and returns the result as a Vector3D structure.
Public operatorStatic memberDivision Divides the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.
Public operatorStatic memberEqualityCompares two Vector3D structures for equality.
Public operatorStatic memberExplicit(Vector3D to Size3D)Converts a Vector3D structure into a Size3D.
Public operatorStatic memberExplicit(Vector3D to Point3D)Converts a Vector3D structure into a Point3D structure.
Public operatorStatic memberInequalityCompares two Vector3D structures for inequality.
Public operatorStatic memberMultiply(Double, Vector3D)Multiplies the specified scalar by the specified Vector3D structure and returns the result as a Vector3D.
Public operatorStatic memberMultiply(Vector3D, Double)Multiplies the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.
Public operatorStatic memberMultiply(Vector3D, Matrix3D)Transforms the coordinate space of the specified Vector3D structure using the specified Matrix3D structure.
Public operatorStatic memberSubtraction(Vector3D, Point3D)Subtracts a Point3D structure from a Vector3D structure.
Public operatorStatic memberSubtraction(Vector3D, Vector3D)Subtracts a Vector3D structure from a Vector3D structure.
Public operatorStatic memberUnaryNegationNegates a Vector3D structure.
Top

  NameDescription
Explicit interface implemetationPrivate methodIFormattable.ToStringThis member is part of the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly by your code. For a description of this member, see ToString.
Top

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)

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft