Vector3D Structure
 
System_CAPS_noteNote

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

Represents a displacement in 3-D space.

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

[SerializableAttribute]
[TypeConverterAttribute(typeof(Vector3DConverter))]
public struct Vector3D : IFormattable
[SerializableAttribute]
[TypeConverterAttribute((Vector3DConverter^::typeid))]
public value struct Vector3D : IFormattable
[<Sealed>]
[<SerializableAttribute>]
[<TypeConverterAttribute(typeof(Vector3DConverter))>]
type Vector3D = 
    struct
        interface IFormattable
    end
<SerializableAttribute>
<TypeConverterAttribute(GetType(Vector3DConverter))>
Public Structure Vector3D
	Implements IFormattable
NameDescription
System_CAPS_pubmethod Vector3D

Initializes a new instance of a Vector3D structure.

NameDescription
System_CAPS_pubproperty

Gets the length of this Vector3D structure.

System_CAPS_pubproperty

Gets the square of the length of this Vector3D structure.

System_CAPS_pubproperty

Gets or sets the component of this Vector3D structure.

System_CAPS_pubproperty

Gets or sets the component of this Vector3D structure.

System_CAPS_pubproperty

Gets or sets the component of this Vector3D structure.

NameDescription
System_CAPS_pubmethod System_CAPS_static Add

Translates the specified Point3D structure by the specified Vector3D structure and returns the result as a Point3D structure.

System_CAPS_pubmethod System_CAPS_static Add

Adds two Vector3D structures and returns the result as a Vector3D structure.

System_CAPS_pubmethod System_CAPS_static AngleBetween

Retrieves the angle required to rotate the first specified Vector3D structure into the second specified Vector3D structure.

System_CAPS_pubmethod System_CAPS_static CrossProduct

Calculates the cross product of two Vector3D structures.

System_CAPS_pubmethod System_CAPS_static Divide

Divides the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.

System_CAPS_pubmethod System_CAPS_static DotProduct

Calculates the dot product of two Vector3D structures.

System_CAPS_pubmethod Equals

Determines whether the specified object is a Vector3D structure and whether the , , and properties of the specified Object are equal to the , , and properties of this Vector3D structure.(Overrides ValueTypeEquals.)

System_CAPS_pubmethod Equals

Compares two Vector3D structures for equality.

System_CAPS_pubmethod System_CAPS_static Equals

Compares two Vector3D structures for equality.

System_CAPS_pubmethod GetHashCode

Gets a hash code for this Vector3D structure. (Overrides ValueTypeGetHashCode.)

System_CAPS_pubmethod GetType

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethod System_CAPS_static Multiply

Multiplies the specified scalar by the specified Vector3D structure and returns the result as a Vector3D.

System_CAPS_pubmethod System_CAPS_static Multiply

Multiplies the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.

System_CAPS_pubmethod System_CAPS_static Multiply

Transforms the coordinate space of the specified Vector3D structure using the specified Matrix3D structure.

System_CAPS_pubmethod Negate

Negates a Vector3D structure.

System_CAPS_pubmethod Normalize

Normalizes the specified Vector3D structure.

System_CAPS_pubmethod System_CAPS_static Parse

Converts a String representation of a 3-D vector into the equivalent Vector3D structure.

System_CAPS_pubmethod System_CAPS_static Subtract

Subtracts a Point3D structure from a Vector3D structure.

System_CAPS_pubmethod System_CAPS_static Subtract

Subtracts a Vector3D structure from a Vector3D structure.

System_CAPS_pubmethod ToString

Creates a String representation of this Vector3D structure. (Overrides ValueTypeToString.)

System_CAPS_pubmethod ToString

Creates a String representation of this Vector3D structure.

NameDescription
System_CAPS_puboperator System_CAPS_static Addition

Translates the specified Point3D structure by the specified Vector3D structure and returns the result as a Point3D structure.

System_CAPS_puboperator System_CAPS_static Addition

Adds two Vector3D structures and returns the result as a Vector3D structure.

System_CAPS_puboperator System_CAPS_static Division

Divides the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.

System_CAPS_puboperator System_CAPS_static Equality

Compares two Vector3D structures for equality.

System_CAPS_puboperator System_CAPS_static

Converts a Vector3D structure into a Point3D structure.

System_CAPS_puboperator System_CAPS_static

Converts a Vector3D structure into a Size3D.

System_CAPS_puboperator System_CAPS_static Inequality

Compares two Vector3D structures for inequality.

System_CAPS_puboperator System_CAPS_static Multiply

Multiplies the specified scalar by the specified Vector3D structure and returns the result as a Vector3D.

System_CAPS_puboperator System_CAPS_static Multiply

Multiplies the specified Vector3D structure by the specified scalar and returns the result as a Vector3D.

System_CAPS_puboperator System_CAPS_static Multiply

Transforms the coordinate space of the specified Vector3D structure using the specified Matrix3D structure.

System_CAPS_puboperator System_CAPS_static Subtraction

Subtracts a Point3D structure from a Vector3D structure.

System_CAPS_puboperator System_CAPS_static Subtraction

Subtracts a Vector3D structure from a Vector3D structure.

System_CAPS_puboperator System_CAPS_static UnaryNegation

Negates a Vector3D structure.

NameDescription
System_CAPS_pubinterface System_CAPS_privmethod IFormattableToString

This 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.

<object property="x,y,z"/>
-or
<object property="x y z"/>
x

The component of this Vector3D structure.

y

The component of this Vector3D structure.

z

The 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)
.NET Framework
Available since 3.0

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

Return to top