// method for drawing pretty stuff using martrix public static void Art() { Canvas c = new Canvas(); GraphicsMatrix gm = new GraphicsMatrix(); // draw small square in the middle gm.AddEdge(225, 225, 0, 275, 225, 0); gm.AddEdge(275, 225, 0, 275, 275, 0); gm.AddEdge(275, 275, 0, 225, 275, 0); gm.AddEdge(225, 275, 0, 225, 225, 0); // premade rotation matrix for speeeeed GraphicsMatrix rotationMatrix = GraphicsMatrix.GetRotationMatrix(0, 0, 1); // loop and make 360 images int counter; for (counter = 0; counter < 36; counter += 4) { c = new Canvas(); c.DrawLines(gm); c.WriteFile(String.Format("{0}.ppm", counter.ToString("D4"))); gm.Rotate(250, 250, 0, rotationMatrix); if (counter % 30 == 0) { Console.WriteLine("Don't exit the program. Trust meee"); } } }
public static void Art(int frame) { Canvas c = new Canvas(); GraphicsMatrix gm = new GraphicsMatrix(); // draw small square in the middle gm.AddEdge(225, 225, 0, 275, 225, 0); gm.AddEdge(275, 225, 0, 275, 275, 0); gm.AddEdge(275, 275, 0, 225, 275, 0); gm.AddEdge(225, 275, 0, 225, 225, 0); // premade rotation matrix for speeeeed GraphicsMatrix rotationMatrix = GraphicsMatrix.GetRotationMatrix(0, 0, frame); c = new Canvas(); gm.Rotate(250, 250, 0, rotationMatrix); c.DrawLines(gm); c.WriteFile(String.Format("{0}Square.ppm", frame.ToString("D4"))); }