Matrix.SetIdentity Metodo

Definizione

Cambia la struttura Matrix in una matrice di identità.

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

Esempio

Nell'esempio seguente viene illustrato come trasformare una struttura in una Matrix matrice di identità.

private Matrix identityExample()
{

    // Get the identity matrix, which is equal to 
    // (1,0,0,1,0,0). 
    Matrix myMatrix = Matrix.Identity;

    Matrix m = new Matrix(1,0,0,1,0,0);

    return myMatrix;
}

Commenti

Una matrice identity ha un valore pari a 1 in coefficienti [1,1],[2,2],[3,3] e un valore pari a 0 nel resto dei coefficienti. Ciò è correlato all'impostazione M11 e M22 a 1 e M12, M21, OffsetXe OffsetY a 0. In una matrice affine, ovvero l'implementazione usata da Windows Presentation Foundation (WPF) per la Matrix struttura, i coefficienti [3,1],[3,2],[3,3] sono impliciti per avere sempre i valori rispettivamente 0,0,1.

1 0 0
0 1 0
0 0 1

Per una matrice di identità, il ToString metodo restituisce la stringa "Identity", anziché i coefficienti dell'oggetto Matrix.

Si applica a

Vedi anche