public Point pointMultMatrix(Point p, TransformMatrix mat) { double px = p.X; double py = p.Y; double e1 = mat.getEl1(); double e2 = mat.getEl2(); double e3 = mat.getEl3(); double e4 = mat.getEl4(); double npX; double npY; npX = (px * e1) + (py * e2); npY = (px * e3) + (px * e4); return new Point(npX, npY); }
public void translateShape() { Point C1 = new Point(Convert.ToDouble(V1X.Text), Convert.ToDouble(V1Y.Text)); Point C2 = new Point(Convert.ToDouble(V2X.Text), Convert.ToDouble(V2Y.Text)); Point C3 = new Point(Convert.ToDouble(V3X.Text), Convert.ToDouble(V3Y.Text)); Point C4 = new Point(Convert.ToDouble(V4X.Text), Convert.ToDouble(V4Y.Text)); transMat = new TransformMatrix(Convert.ToDouble(M1.Text), Convert.ToDouble(M2.Text), Convert.ToDouble(M3.Text), Convert.ToDouble(M4.Text)); Console.WriteLine(transMat.ToString()); Point tp1 = pointMultMatrix(C1, transMat); Point tp2 = pointMultMatrix(C2, transMat); Point tp3 = pointMultMatrix(C3, transMat); Point tp4 = pointMultMatrix(C4, transMat); Console.WriteLine("1) New point x: {0}, New point y: {1}", tp1.X, tp1.Y); Console.WriteLine("2) New point x: {0}, New point y: {1}", tp2.X, tp2.Y); Console.WriteLine("3) New point x: {0}, New point y: {1}", tp3.X, tp3.Y); Console.WriteLine("4) New point x: {0}, New point y: {1}", tp4.X, tp4.Y); mw.drawVertexLabel(C1); //mw.drawShape(new Coordinate(tp3.X, tp3.Y), new Coordinate(tp2.X, tp2.Y)); }