Share via


Vector.Negate Método

Definição

Nega este vetor. O vetor tem a mesma magnitude de antes, mas sua direção agora é oposta.

public:
 void Negate();
public void Negate ();
member this.Negate : unit -> unit
Public Sub Negate ()

Exemplos

O exemplo a seguir mostra como usar esse método para negar um vetor.

private Vector negateExample()
{
    Vector vectorResult = new Vector(20, 30);

    // Make the direction of the Vector opposite but
    // leave the vector magnitude the same.
    // vectorResult is equal to (-20, -30)
    vectorResult.Negate();

    return vectorResult;
}

Aplica-se a

Confira também