# Vector3DVector3DVector3DVector3D Struct

## Definição

Representa um deslocamento no espaço 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``````
Herança
Vector3DVector3DVector3DVector3D
Atributos
Implementações

## Exemplos

Este Vector3D exemplo mostra como subtrair estruturas usando o operador de subtração sobrecarregado (`-`) e o Vector3D método Subtract estático.This example shows how to subtract Vector3D structures using the overloaded subtraction (`-`) operator and the Vector3D static Subtract method.

O código a seguir mostra como usar os Vector3D métodos de subtração.The following code shows how to use the Vector3D subtraction methods. Primeiro, as Vector3D estruturas são instanciadas.First, the Vector3D structures are instantiated. As Vector3D estruturas são subtraídas usando o operador sobrecarregado (`-`) e, em seguida, são subtraídas usando o Subtract método estático.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)
``````

## Comentários

### Uso do Atributo XAMLXAML Attribute Usage

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

### Valores XAMLXAML Values

xx
O X componenteVector3D desta estrutura.The X component of this Vector3D structure.

yy
O Y componenteVector3D desta estrutura.The Y component of this Vector3D structure.

zz
O Z componenteVector3D desta estrutura.The Z component of this Vector3D structure.

## Construtores

 Vector3D(Double, Double, Double) Vector3D(Double, Double, Double) Vector3D(Double, Double, Double) Vector3D(Double, Double, Double) Inicializa uma nova instância de uma estrutura Vector3D.Initializes a new instance of a Vector3D structure.

 Length Length Length Length Obtém o tamanho desta estrutura Vector3D.Gets the length of this Vector3D structure. LengthSquared LengthSquared LengthSquared LengthSquared Obtém o quadrado do comprimento dessa estrutura Vector3D.Gets the square of the length of this Vector3D structure. X X X X Obtém ou define o componente X desta estrutura Vector3D.Gets or sets the X component of this Vector3D structure. Y Y Y Y Obtém ou define o componente Y desta estrutura Vector3D.Gets or sets the Y component of this Vector3D structure. Z Z Z Z Obtém ou define o componente Z desta estrutura Vector3D.Gets or sets the Z component of this Vector3D structure.