Matrix.TranslatePrepend(Double, Double) Matrix.TranslatePrepend(Double, Double) Matrix.TranslatePrepend(Double, Double) Matrix.TranslatePrepend(Double, Double) Method

定義

在這個 Matrix 結構之前加上所指定位移的轉換。Prepends a translation of the specified offsets to this Matrix structure.

public:
 void TranslatePrepend(double offsetX, double offsetY);
public void TranslatePrepend (double offsetX, double offsetY);
member this.TranslatePrepend : double * double -> unit
Public Sub TranslatePrepend (offsetX As Double, offsetY As Double)

參數

offsetX
Double Double Double Double

要沿著 X 軸移離這個 Matrix 的位移量。The amount to offset this Matrix along the x-axis.

offsetY
Double Double Double Double

要沿著 Y 軸移離這個 Matrix 的位移量。The amount to offset this Matrix along the y-axis.

範例

下列範例示範如何在Matrix結構前面加上轉譯。The following example shows how prepend a translation onto a Matrix structure.

private Matrix translatePrependExample()
{
    
    Matrix myMatrix = new Matrix(5, 10, 15, 20, 25, 30);
    
    myMatrix.TranslatePrepend(5, 10);
    
    
    // myMatrix is equal to (5, 10, 15, 20, 200, 280).
    return myMatrix;
      
}

備註

在複合轉換中, 個別轉換的順序很重要。In a composite transformation, the order of individual transformations is important. 例如, 如果您先旋轉, 然後調整規模, 然後轉譯, 則會得到不同的結果, 而不是您第一次轉譯, 然後旋轉再調整。For example, if you first rotate, then scale, then translate, you get a different result than if you first translate, then rotate, then scale. 其中一個原因是很重要的, 就是旋轉和縮放之類的轉換是根據座標系統的原點來完成。One reason order is significant is that transformations like rotation and scaling are done with respect to the origin of the coordinate system. 調整以原點為中心的物件, 會產生不同的結果, 而不是縮放已從原點移出的物件。Scaling an object that is centered at the origin produces a different result than scaling an object that has been moved away from the origin. 同樣地, 旋轉原點中央的物件, 會產生不同的結果, 而不是旋轉離開來源的物件。Similarly, rotating an object that is centered at the origin produces a different result than rotating an object that has been moved away from the origin.

適用於

另請參閱