Matrix.SetIdentity 方法

定義

將這個 Matrix 結構變更為單位矩陣。

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

範例

下列範例示範如何將結構轉換成 Matrix 識別矩陣。

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

備註

識別矩陣在係數 [1,1],[2,2],[3,3,3] 中具有 1 的值,而其餘係數中的值為 0。 這與設定 M11M22 與 1 和 M12 、、 M21OffsetXOffsetY 相互關聯至 0。 在 affine 矩陣中,這是Windows Presentation Foundation (WPF) 用於 Matrix 結構的實作,係數 [3,1],[3,2],[3.3] 會分別隱含為 0,0,1。

1 0 0
0 1 0
0 0 1

針對識別矩陣,方法會 ToString 傳回字串 「Identity」,而不是 的 Matrix 係數。

適用於

另請參閱