Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            this.timer1.Interval = 50;
            this.timer1.Enabled  = true;

            this.Width          = WIDTH;
            this.Height         = HEIGHT;
            this.DoubleBuffered = true;

            this.cameraState = CameraState.Default;

            this.keyboardState = new KeyboardState();

            // Define axes
            x_axis = new AxisX(3);
            y_axis = new AxisY(3);
            z_axis = new AxisZ(3);

            this.cube = new Cube(Color.Purple);

            this.cubeController = new CubeController();

            this.animationEngine           = new AnimationEngine(this.cameraState, this.cubeController);
            this.animationEngine.Finished += ResetAnimation;
        }
Ejemplo n.º 2
0
        Vector vector = new Vector(); // for translation

        public Form1()
        {
            InitializeComponent();

            this.Width          = WIDTH;
            this.Height         = HEIGHT;
            this.DoubleBuffered = true;

            Vector v1 = new Vector();

            Console.WriteLine(v1);
            Vector v2 = new Vector(1, 2, 1);

            Console.WriteLine(v2);
            Vector v3 = new Vector(2, 6, 1);

            Console.WriteLine(v3);
            Vector v4 = v2 + v3;

            Console.WriteLine(v4); // 3, 8

            Matrix m1 = new Matrix();

            Console.WriteLine(m1); // 1, 0, 0, 1

            Matrix m2 = new Matrix(2, 4, -1, 3);

            Console.WriteLine(m2);
            Console.WriteLine(m1 + m2); // 3, 4, -1, 4
            Console.WriteLine(m1 - m2); // -1, -4, 1, -2
            Console.WriteLine(m2 * m2); // 0, 20, -5, 5
            Console.WriteLine(m2 * v3); // 28, 16

            Matrix m3 = new Matrix();
            Vector v5 = new Vector(3, 6, 4);
            Matrix m4 = new Matrix(3, 4, 7, -3, 11, 10, 3, 1, 3);

            Console.WriteLine(m3);

            m3 = Matrix.TranslateMatrix(v5);

            Console.WriteLine(m3);
            Console.WriteLine(m3 * m4);
            Console.WriteLine(m3 - m4);
            Console.WriteLine(m3 + m4);

            // Define axes
            x_axis = new AxisX(3);
            y_axis = new AxisY(3);
            z_axis = new AxisZ(3);

            // Create object
            square  = new Square(Color.Purple, 3);
            square1 = new Square(Color.Orange, 2);
            square2 = new Square(Color.Cyan, 1);
            square3 = new Square(Color.DarkBlue, 1);
            cube    = new Cube(Color.Purple);
        }
Ejemplo n.º 3
0
        public Form1()
        {
            InitializeComponent();
            UpdateLabel();
            this.Width  = 800;
            this.Height = 600;

            x_axis = new AxisX(3);
            y_axis = new AxisY(3);
            z_axis = new AxisZ(3);
            cube   = new Cube(Color.Pink);
        }
Ejemplo n.º 4
0
        public Form1()
        {
            InitializeComponent();

            this.Width          = WIDTH;
            this.Height         = HEIGHT;
            this.DoubleBuffered = true;

            Vector v1 = new Vector();

            Console.WriteLine(v1);
            Vector v2 = new Vector(1, 2);

            Console.WriteLine(v2);
            Vector v3 = new Vector(2, 6);

            Console.WriteLine(v3);
            Vector v4 = v2 + v3;

            Console.WriteLine(v4); // 3, 8

            Matrix m1 = new Matrix();

            Console.WriteLine(m1); // 1, 0, 0, 1
            Matrix m2 = new Matrix(
                2, 4, 0,
                -1, 3, 0,
                0, 0, 0);

            Console.WriteLine(m2);
            Console.WriteLine(m1 + m2); // 3, 4, -1, 4
            Console.WriteLine(m1 - m2); // -1, -4, 1, -2
            Console.WriteLine(m2 * m2); // 0, 20, -5, 5

            Console.WriteLine(m2 * v3); // 28, 16

            // Define axes
            x_axis = new AxisX(200);
            y_axis = new AxisY(200);
            z_axis = new AxisZ(200);

            // Initialize objects
            cube    = new Cube(Color.Purple);
            piramid = new Piramid(Color.BurlyWood);

            // Initialize the timer
            timer           = new System.Timers.Timer(50);
            timer.AutoReset = true;
            timer.Elapsed  += CubeAnimation;
            timer.Start();
        }
Ejemplo n.º 5
0
        public Form1()
        {
            InitializeComponent();

            this.Width          = WIDTH;
            this.Height         = HEIGHT;
            this.DoubleBuffered = true;

            Vector v1 = new Vector();

            Console.WriteLine(v1);
            Vector v2 = new Vector(1, 2);

            Console.WriteLine(v2);
            Vector v3 = new Vector(2, 6);

            Console.WriteLine(v3);
            Vector v4 = v2 + v3;

            Console.WriteLine(v4); // 3, 8

            Matrix m1 = new Matrix();

            Console.WriteLine(m1); // 1, 0, 0, 1
            Matrix m2 = new Matrix(
                2, 4, 6,
                -1, 3, -3,
                -2, -4, -6);

            Console.WriteLine(m2);      // 2, 4, -1, 3
            Console.WriteLine(m1 + m2); // 3, 4, -1, 4
            Console.WriteLine(m1 - m2); // -1, -4, 1, -2
            Console.WriteLine(m2 * m2); // 0, 20, -5, 5

            Console.WriteLine(m2 * v3); // 28, 16

            // Define axes
            x_axis = new AxisX(2);
            y_axis = new AxisY(2);
            z_axis = new AxisZ(2);

            // Create object
            cube = new Cube(Color.Purple);

            // Timer
            timer          = new System.Windows.Forms.Timer();
            timer.Interval = 50;
            timer.Tick    += new EventHandler(timer_tick);
        }