Vector.Negate Metoda

Definicja

Neguje ten wektor. Wektor ma taką samą wielkość jak poprzednio, ale jego kierunek jest teraz przeciwny.

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

Przykłady

W poniższym przykładzie pokazano, jak za pomocą tej metody negować wektor.

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;
}

Dotyczy

Zobacz też