Exemplo n.º 1
0
 private void InitializeAngleGrid()
 {
     AngleZero = new _3Vector(0, 0, 0);
     AngleY    = new _3Vector(0, 70, 0);
     AngleZ    = new _3Vector(0, 0, 70);
     AngleX    = new _3Vector(70, 0, 0);
 }
Exemplo n.º 2
0
        public static void AngleAxis(_3Matrix rotationResult, PictureBox AnglePictureBox,
                                     _3Vector AngleX,
                                     _3Vector AngleY,
                                     _3Vector AngleZ)
        {
            AnglePictureBox.Image = new Bitmap(AnglePictureBox.Width, AnglePictureBox.Height);
            using (var g = System.Drawing.Graphics.FromImage(AnglePictureBox.Image))
            {
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                var resX = rotationResult.MultiplyByVector(AngleX);
                var resY = rotationResult.MultiplyByVector(AngleY);
                var resZ = rotationResult.MultiplyByVector(AngleZ);

                for (int i = 1; i <= 19; i++)
                {
                    g.DrawLine(Pens.Gray, i * 10, 0, i * 10, 200); //x
                    g.DrawLine(Pens.Gray, 0, i * 10, 200, i * 10); //y
                }
                var penX = new Pen(Color.LightGreen, 2);
                var penY = new Pen(Color.Blue, 2);
                var penZ = new Pen(Color.Red, 2);
                g.DrawLine(penX, 100, 100, (float)resX.a + 100, (float)resX.c + 100);
                g.DrawLine(penY, 100, 100, (float)resY.a + 100, (float)resY.c + 100);
                g.DrawLine(penZ, 100, 100, (float)resZ.a + 100, (float)resZ.c + 100);
            }
        }
Exemplo n.º 3
0
        private static _3Matrix RotateZ(double z)
        {
            _3Vector r1 = new _3Vector(Math.Cos(-z), -Math.Sin(-z), 0),
                     r2 = new _3Vector(Math.Sin(-z), Math.Cos(-z), 0),
                     r3 = new _3Vector(0, 0, 1);

            return(new _3Matrix(r1, r2, r3));
        }
Exemplo n.º 4
0
        private static _3Matrix RotateY(double y)
        {
            _3Vector r1 = new _3Vector(Math.Cos(-y), 0, Math.Sin(-y)),
                     r2 = new _3Vector(0, 1, 0),
                     r3 = new _3Vector(-Math.Sin(-y), 0, Math.Cos(-y));

            return(new _3Matrix(r1, r2, r3));
        }
Exemplo n.º 5
0
        private static _3Matrix RotateX(double x)
        {
            _3Vector r1 = new _3Vector(1, 0, 0),
                     r2 = new _3Vector(0, Math.Cos(-x), -Math.Sin(-x)),
                     r3 = new _3Vector(0, Math.Sin(-x), Math.Cos(-x));

            return(new _3Matrix(r1, r2, r3));
        }
Exemplo n.º 6
0
        private static void EffectColourScheme(_3Matrix rotationResult, Domain.ContainerObjects.Point <_3Vector, _3Vector> pointPair, out _3Vector pointA, out _3Vector pointB, out Pen pen)
        {
            double blue = 0;
            double red  = 0;

            pointA = rotationResult.MultiplyByVector(pointPair.Xval);
            pointB = rotationResult.MultiplyByVector(pointPair.Yval);
            var gradient = (pointPair.Yval.c - pointPair.Xval.c) / (pointPair.Yval.a - pointPair.Xval.a);

            if (Math.Abs(gradient) > 1)
            {
                if (Math.Abs(gradient) > 5000)
                {
                    gradient = 5000;
                }
                blue = 255 * (Math.Abs(gradient) / 5000);
            }

            if (Math.Abs(gradient) < 1)
            {
                if (gradient == 0)
                {
                    gradient = 0.001;
                }
                //19.60
                red = 255 * (1 - Math.Abs(gradient));
            }

            pen = new Pen(Color.FromArgb((int)Math.Round(red, 0), 100, (int)Math.Round(blue, 0)));
        }