Example #1
0
        void FirstTransformation(Abstract3DInstance instance, double Xc, double Yc)
        {
            if (instance == null)
            {
                return;
            }

            TransformEngine.Scale(instance, 140, 0, 0, 0);
            TransformEngine.Translate(instance, Xc, Yc, 0);

            _scaleFactor = 1;
        }
Example #2
0
        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            if (_instance3D == null)
            {
                return;
            }

            const double cMin = 0.5;
            const double cMax = 2;

            double sf = (cMax - cMin) / Convert.ToDouble(trackBar1.Maximum - trackBar1.Minimum) * Convert.ToDouble(trackBar1.Value - trackBar1.Minimum) + cMin;

            TransformEngine.Scale(_instance3D, sf / _scaleFactor, pictureBox1.Width / 2, pictureBox1.Height / 2, 0);
            _scaleFactor = sf;

            Render();
        }
Example #3
0
        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (_instance3D == null)
            {
                return;
            }

            if (e.Button == MouseButtons.Left)
            {
                PointF       point   = new PointF(e.X, e.Y);
                const double divider = 64;

                double angleXZ = (point.X - _startPoint.X) / divider;
                double angleYZ = (point.Y - _startPoint.Y) / divider;

                TransformEngine.RotateXZ(_instance3D, angleXZ, pictureBox1.Width / 2, 0);
                TransformEngine.RotateYZ(_instance3D, angleYZ, pictureBox1.Height / 2, 0);

                Render();

                _startPoint = point;
            }
        }