Vector.Negate Metod

Definition

Negerar den här vektorn. Vektorn har samma storlek som tidigare, men dess riktning är nu motsatt.

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

Exempel

I följande exempel visas hur du använder den här metoden för att negera en vektor.

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

Gäller för

Se även