# Vector3D Estructura

## Definición

Representa un desplazamiento en el espacio 3D.Represents a displacement in 3-D space.

``public value class Vector3D : IFormattable``
``````[System.ComponentModel.TypeConverter(typeof(System.Windows.Media.Media3D.Vector3DConverter))]
[System.Serializable]
public struct Vector3D : IFormattable``````
``````type Vector3D = struct
interface IFormattable``````
``````Public Structure Vector3D
Implements IFormattable``````
Herencia
Vector3D
Atributos
Implementaciones

## Ejemplos

En este ejemplo se muestra cómo Vector3D restar estructuras mediante el operador de resta (`-`) sobrecargado Vector3D y Subtract el método estático.This example shows how to subtract Vector3D structures using the overloaded subtraction (`-`) operator and the Vector3D static Subtract method.

En el código siguiente se muestra cómo usar Vector3D los métodos de sustracción.The following code shows how to use the Vector3D subtraction methods. En primer lugar Vector3D , se crean instancias de las estructuras.First, the Vector3D structures are instantiated. Las Vector3D estructuras se restan utilizando el operador sobrecargado (`-`) y, a continuación, se restan con el método estático Subtract .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)
``````

## Comentarios

### Uso de atributos XAMLXAML Attribute Usage

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

### Valores XAMLXAML Values

xx
Componente X de la estructura Vector3D.The X component of this Vector3D structure.

yy
Componente Y de la estructura Vector3D.The Y component of this Vector3D structure.

zz
Componente Z de la estructura Vector3D.The Z component of this Vector3D structure.

## Constructores

 Inicializa una nueva instancia de una estructura Vector3D.Initializes a new instance of a Vector3D structure.

 Obtiene la longitud de esta estructura Vector3D.Gets the length of this Vector3D structure. Obtiene el cuadrado de la longitud de esta estructura Vector3D.Gets the square of the length of this Vector3D structure. Obtiene o establece el componente X de esta estructura Vector3D.Gets or sets the X component of this Vector3D structure. Obtiene o establece el componente Y de esta estructura Vector3D.Gets or sets the Y component of this Vector3D structure. Obtiene o establece el componente Z de esta estructura Vector3D.Gets or sets the Z component of this Vector3D structure.