Ejemplo n.º 1
0
        protected override void Animate(int frameNumber)
        {
            time = frameNumber;

            xPos = v * Math.Cos(theta) * Math.Cos(phi) * time;
            yPos = v * Math.Cos(theta) * Math.Sin(phi) * time;
            zPos = v * Math.Sin(theta) * time + a * time * time;

            vp.xPos = xPos;
            vp.yPos = yPos;
            vp.zPos = zPos;

            double vXY = v * Math.Cos(theta);
            double vZ  = v * Math.Sin(theta) + a * time * 2;

            alpha = -Utility.RadToDeg(Math.Atan(vZ / vXY));

            tip = new Point3D(0, 0, 14); // rocket tip's location

            Translation t1 = new Translation(xPos, yPos, zPos);

            devDept.Geometry.Rotation t2 = new devDept.Geometry.Rotation(Utility.DegToRad(alpha + 90), new Vector3D(-Math.Sin(phi), Math.Cos(phi), 0));

            tip.TransformBy(t1 * t2);
        }
Ejemplo n.º 2
0
        protected override void OnContentRendered(EventArgs e)
        {
            // adjusts grid extents ad step
            model1.GetGrid().Max  = new Point3D(200, 200);
            model1.GetGrid().Step = 25;

            int nArrows   = 13;
            int arcRadius = 100;

            double arcSpan = 120;

            // adds the arc
            model1.Entities.Add(
                new Arc(
                    Point3D.Origin,
                    arcRadius,
                    Utility.DegToRad(340), Utility.DegToRad(340 + 150)
                    ));

            for (int i = 0; i < nArrows; i++)
            {
                // angle in rad
                double radAngle = Utility.DegToRad(arcSpan * i / nArrows);

                // Creates a mesh with the arrow shape
                Mesh m = Mesh.CreateArrow(4, 100 - i * 4, 8, 24, 16, Mesh.natureType.Smooth);

                m.EdgeStyle = Mesh.edgeStyleType.Sharp;

                // Translation transformation
                Translation tra = new Translation(arcRadius * Math.Cos(radAngle), arcRadius * Math.Sin(radAngle), 0);

                // Rotation transformation
                devDept.Geometry.Rotation rot = new devDept.Geometry.Rotation(radAngle, Vector3D.AxisZ);

                // Combines the two
                Transformation combined = tra * rot;

                // applies the transformation to the arrow
                m.TransformBy(combined);

                // adds the arrow to the master entity array
                model1.Entities.Add(m, System.Drawing.Color.FromArgb(120 + i * 10, 255 - i * 10, 0));
            }

            // sets trimetric view
            model1.SetView(viewType.Trimetric);

            // fits the model in the viewport
            model1.ZoomFit();

            //refresh the model control
            model1.Invalidate();

            base.OnContentRendered(e);
        }
Ejemplo n.º 3
0
        private void 이동회전확대조합ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // 객체 생성
            Mesh arrow = Mesh.CreateArrow(5, 50, 10, 15, 16, Mesh.natureType.Smooth);
            // 객체 편집(변형) 정보
            double rad = Utility.DegToRad(90);

            devDept.Geometry.Rotation rotation = new devDept.Geometry.Rotation(rad, new Vector3D(0, 0, 1), new Point3D(0, 0, 0)); // 회전
            Translation translation            = new Translation(10, 10, 0);                                                      // 이동
            Scaling     scaling = new Scaling(2);                                                                                 // 확대
            // 조합
            Transformation trans = new Transformation();

            trans = rotation * translation * scaling;
            // 객체 편집(변형)
            arrow.TransformBy(trans);
            // 객체를 추가하고 화면 갱신
            model1.Entities.Add(arrow, Color.GreenYellow);
            model1.ZoomFit();
            model1.Invalidate();
        }