/// <summary> /// Push skew (shear) transformation to matrix. The skewing origin is assumed at (0, 0) /// </summary> /// <param name="angleX">X-axis skew angle (in degree)</param> /// <param name="angleY">Y-axis skew angle (in degree)</param> public void Skew(double angleX, double angleY) { if (currentTransform == null) { currentTransform = new Matrix3x3(); } transformRequired = true; currentTransform.Skew(angleX, angleY); }
/// <summary> /// Apply current transformation for (centerX, centerY) then skew at center point /// </summary> /// <param name="xSkewAngle">x skew angle (in degree)</param> /// <param name="ySkewAngle">y skew angle (in degree)</param> /// <param name="centerX">center point x coordinate</param> /// <param name="centerY">center point y coordinate</param> public void SkewPrepend(double xSkewAngle, double ySkewAngle, double centerX, double centerY) { if ((xSkewAngle != 0) || (ySkewAngle != 0)) { Matrix3x3 matrix = new Matrix3x3(); matrix.Translate(-centerX, -centerY); matrix.Skew(xSkewAngle, ySkewAngle); matrix.Translate(centerX, centerY); // then prepend multiply this.PrependSelfMultiply(matrix.Sx, matrix.Sy, matrix.Shx, matrix.Shy, matrix.Tx, matrix.Ty); //PrependSelfMultiply(1.0, 1.0, // Math.Tan(xSkewAngle * DegreeToRadianFactor), // Math.Tan(ySkewAngle * DegreeToRadianFactor), // centerX, centerY); isChanged = true; SimpleScaleAndTranslateOnly = false; ScaleAndTransformOnly = false; } }