public virtual void testShiftXY() { JDFMatrix m = new JDFMatrix(EnumOrientation.Rotate90, 0, 0); m.shift(new JDFXYPair(20, 25)); Assert.AreEqual(new JDFMatrix("0 1 -1 0 20 25"), m); }
public virtual void testCreate() { JDFMatrix m = new JDFMatrix(90, 20, 20); JDFMatrix m2 = new JDFMatrix(EnumOrientation.Rotate90, 0, 0); m2.shift(20, 20); Assert.AreEqual(m, m2); }
public virtual void testClone() { JDFMatrix m = (JDFMatrix)JDFMatrix.unitMatrix.Clone(); m.rotate(180); Assert.AreNotEqual(JDFMatrix.unitMatrix, m); Assert.AreEqual(JDFMatrix.unitMatrix, new JDFMatrix("1 0 0 1 0 0")); Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate180, 0, 0), m); }
/// /// <summary> * concatinates this with m /// * </summary> /// * <param name="m"> the matrix to concatinate </param> /// * <param name="tY"> shift in y direction </param> /// public virtual void concat(JDFMatrix m) { Matrix a = AffineTransform; Matrix ma = m.AffineTransform; //UPGRADE_TODO: Method 'java.awt.geom.AffineTransform.concatenate' was converted to 'System.Drawing.Drawing2D.Matrix.Multiply' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtgeomAffineTransformconcatenate_javaawtgeomAffineTransform'" a.Multiply(ma, MatrixOrder.Append); AffineTransform = a; }
public virtual void testShift() { JDFMatrix m = new JDFMatrix(EnumOrientation.Rotate0, 0, 0); Assert.AreEqual(JDFMatrix.unitMatrix, m); m.shift(10, 11); Assert.AreEqual(new JDFMatrix("1 0 0 1 10 11"), m); m.shift(10, 11); Assert.AreEqual(new JDFMatrix("1 0 0 1 20 22"), m, "2nd shift adds up"); }
/// /// <summary> * constructs a matrix with all values set via a JDFMatrix /// * </summary> /// * <param name="JDma"> the given matrix </param> /// public JDFMatrix(JDFMatrix ma) : base(JDFBaseDataTypes_Fields.MAX_MATRIX_DIMENSION) { A = ma.A; B = ma.B; C = ma.C; D = ma.D; Tx = ma.Tx; Ty = ma.Ty; }
public virtual void testSetString() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); JDFMatrix m = new JDFMatrix("1 0 0 1 0 0"); Assert.AreEqual(JDFMatrix.unitMatrix, m); n.setAttribute("foo", m, null); Assert.AreEqual(n.getAttribute("foo"), m.ToString()); }
public virtual void testConcat() { JDFMatrix m = new JDFMatrix(EnumOrientation.Rotate90, 0, 0); JDFMatrix m2 = new JDFMatrix(EnumOrientation.Rotate270, 0, 0); m.concat(m2); Assert.AreEqual(JDFMatrix.unitMatrix, m); m = new JDFMatrix(EnumOrientation.Rotate90, 0, 0); m.concat(m); Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate180, 0, 0), m); m = new JDFMatrix(EnumOrientation.Flip180, 0, 0); m.concat(m); Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate0, 0, 0), m); }
public virtual void testRotate() { JDFMatrix m = new JDFMatrix(EnumOrientation.Rotate0, 0, 0); Assert.AreEqual(JDFMatrix.unitMatrix, m); m.rotate(180); Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate180, 0, 0), m); m.rotate(90); Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate270, 0, 0), m); m.rotate(180); Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate90, 0, 0), m); m = new JDFMatrix(EnumOrientation.Flip0, 0, 0); m.rotate(180); Assert.AreEqual(new JDFMatrix(EnumOrientation.Flip180, 0, 0), m); m.rotate(90); Assert.AreEqual(new JDFMatrix(EnumOrientation.Flip270, 0, 0), m); }
/// /// <summary> * equals - returns true if both JDFMatrices are equal, otherwise false /// * </summary> /// * <returns> boolean - true if equal otherwise false </returns> /// public override bool Equals(object other) { if (this == other) { return(true); } if (other == null) { return(false); } if (!other.GetType().Equals(this.GetType())) { return(false); } JDFMatrix m = (JDFMatrix)other; return((Math.Abs(this.A - m.A) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.B - m.B) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.C - m.C) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.D - m.D) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.Tx - m.Tx) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.Ty - m.Ty) <= JDFBaseDataTypes_Fields.EPSILON)); }
public virtual void testOrientation() { JDFMatrix m = new JDFMatrix(EnumOrientation.Rotate0, 0, 0); Assert.AreEqual(JDFMatrix.unitMatrix, m); }