"Matrix After 2nd Multiplication", 6, 80) ' Display the result of the previous multiplication MyMatrix1.Multiply(myMatrix3, MatrixOrder.Append) ' Multiply the result from the pervious multiplication by "Matrix After 1st Multiplication", 6, 60) ' Display the result of the multiplication of Matrix1 and MyMatrix1.Multiply(myMatrix2, MatrixOrder.Append) ListMatri圎lementsHelper(e, myMatrix1, "Beginning Matrix", 6, 40) ' Display the elements of the starting matrix. SolidBrush myBrush = new SolidBrush(Color.Black) MyMatrix1.Multiply(myMatrix3, MatrixOrder.Append) Į.Graphics.DrawRectangle(myPen, 0, 0, 100, 100) Į.Graphics.DrawRectangle(myPen2, 0, 0, 100, 100) Multiply the result from the pervious multiplication by ListMatri圎lements(e, myMatrix1, "Beginning Matrix", 6, 40) Public void MultiplyExample(PaintEventArgs e) Draw the set of path points and types to the screen.įor ( i = 0 i Graphics->DrawString( String::Concat( matrix->Elements, ", " ), myFont, myBrush, (float)X, (float)y ) SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ) Į->Graphics->DrawString( String::Concat( matrixName, ": " ), myFont, myBrush, (float)x, (float)y ) System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ) Set up variables for drawing the array Void ListMatri圎lements1( PaintEventArgs^ e, Matrix^ matrix, String^ matrixName, int numElements, int y ) The following function is a helper function to Draw the rectangle after transformation.Į->Graphics->DrawRectangle( myPen2, 0, 0, 100, 100 ) Draw the rectangle prior to transformation.Į->Graphics->DrawRectangle( myPen, 0, 0, 100, 100 ) ListMatri圎lements1( e, myMatrix1, "Matrix After 2nd Multiplication", 6, 80 ) Display the result of the previous multiplication MyMatrix1->Multiply( myMatrix3, MatrixOrder::Append ) Multiply the result from the previous multiplication by ListMatri圎lements( e, myMatrix1, "Matrix After 1st Multiplication", 6, 60 ) Display the result of the multiplication of Matrix1 and MyMatrix1->Multiply( myMatrix2, MatrixOrder::Append ) ListMatri圎lements( e, myMatrix1, "Beginning Matrix", 6, 40 ) Display the elements of the starting matrix. Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ) Pen^ myPen = gcnew Pen( Color::Blue,1.0f ) Void MultiplyExample( PaintEventArgs^ e ) Notice that the red rectangle has been scaled by a factor of two in the horizontal direction, then rotated 90 degrees, and then moved (translated) 250 points in the x direction and 50 points in the y direction. Multiplies the result stored in matrix 1 by matrix 3, and again stores the result in matrix 1.ĭraws a rectangle to the screen prior to applying the matrix 1 transform (the blue rectangle).ĭraws the transformed rectangle to the screen (the red rectangle), using the same coordinates as the previous rectangle. Multiplies matrix 1 by matrix 2 and stores the result in matrix 1. Lists the contents of matrix 1 to the screen. The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, an Paint event object. The MatrixOrder that represents the order of the multiplication.
0 Comments
Leave a Reply. |