コード例 #1
0
ファイル: Matrix.cs プロジェクト: zymemail/itext7-dotnet
 /// <summary>Subtracts a matrix from this matrix and returns the results</summary>
 /// <param name="arg">the matrix to subtract from this matrix</param>
 /// <returns>a Matrix object</returns>
 public virtual iText.Kernel.Geom.Matrix Subtract(iText.Kernel.Geom.Matrix arg)
 {
     iText.Kernel.Geom.Matrix rslt = new iText.Kernel.Geom.Matrix();
     float[] a = vals;
     float[] b = arg.vals;
     float[] c = rslt.vals;
     c[I11] = a[I11] - b[I11];
     c[I12] = a[I12] - b[I12];
     c[I13] = a[I13] - b[I13];
     c[I21] = a[I21] - b[I21];
     c[I22] = a[I22] - b[I22];
     c[I23] = a[I23] - b[I23];
     c[I31] = a[I31] - b[I31];
     c[I32] = a[I32] - b[I32];
     c[I33] = a[I33] - b[I33];
     return(rslt);
 }
コード例 #2
0
ファイル: Matrix.cs プロジェクト: zymemail/itext7-dotnet
 /// <summary>
 /// multiplies this matrix by 'b' and returns the result
 /// See http://en.wikipedia.org/wiki/Matrix_multiplication
 /// </summary>
 /// <param name="by">The matrix to multiply by</param>
 /// <returns>the resulting matrix</returns>
 public virtual iText.Kernel.Geom.Matrix Multiply(iText.Kernel.Geom.Matrix by)
 {
     iText.Kernel.Geom.Matrix rslt = new iText.Kernel.Geom.Matrix();
     float[] a = vals;
     float[] b = by.vals;
     float[] c = rslt.vals;
     c[I11] = a[I11] * b[I11] + a[I12] * b[I21] + a[I13] * b[I31];
     c[I12] = a[I11] * b[I12] + a[I12] * b[I22] + a[I13] * b[I32];
     c[I13] = a[I11] * b[I13] + a[I12] * b[I23] + a[I13] * b[I33];
     c[I21] = a[I21] * b[I11] + a[I22] * b[I21] + a[I23] * b[I31];
     c[I22] = a[I21] * b[I12] + a[I22] * b[I22] + a[I23] * b[I32];
     c[I23] = a[I21] * b[I13] + a[I22] * b[I23] + a[I23] * b[I33];
     c[I31] = a[I31] * b[I11] + a[I32] * b[I21] + a[I33] * b[I31];
     c[I32] = a[I31] * b[I12] + a[I32] * b[I22] + a[I33] * b[I32];
     c[I33] = a[I31] * b[I13] + a[I32] * b[I23] + a[I33] * b[I33];
     return(rslt);
 }