예제 #1
0
 public MyHybridMesh(MyHybridMesh another)
     : base(another)
 {
     wireVertices = new Point3D[another.wireVertices.Length];
     for (int i = 0; i < wireVertices.Length; i++)
     {
         wireVertices[i] = (Point3D)another.wireVertices[i].Clone();
     }
 }
예제 #2
0
        private void ChangeNature()
        {
            for (int i = 0; i < model1.Entities.Count; i++)
            {
                Entity ent = model1.Entities[i];
                if (ent is MyHybridMesh)
                {
                    MyHybridMesh mcm = (MyHybridMesh)ent;
                    mcm.ChangeNature(wire ? entityNatureType.Polygon : entityNatureType.Wire);
                    ent.UpdateBoundingBox(new TraversalParams(null, model1)); // to update the values inside the entity
                }
            }

            model1.Entities.Regen();

            model1.Entities.UpdateBoundingBox();
            wire = !wire;
            model1.Invalidate();
        }
예제 #3
0
        public static void CreateHybridEntity(Model vp)
        {
            double width = 0.5;

            Point3D[] profilePoints = new Point3D[]
            {
                new Point3D(-5, 0, 0), new Point3D(5, 0, 0), new Point3D(5, 0.5, 0),
                new Point3D(width, width, 0), new Point3D(width, 10 - width, 0), new Point3D(5, 10 - width, 0),
                new Point3D(5, 10, 0), new Point3D(-5, 10, 0), new Point3D(-5, 10 - width, 0),
                new Point3D(-width, 10 - width, 0), new Point3D(-width, width, 0), new Point3D(-5, width, 0), new Point3D(-5, 0, 0)
            };

            LinearPath profileLp = new LinearPath(profilePoints);
            Region     profile   = new Region(profileLp);

            double length1 = 80;

            MyHybridMesh m = profile.ExtrudeAsMesh <MyHybridMesh>(new Vector3D(0, 0, length1), 0.1, Mesh.natureType.Plain);

            m.Rotate(Math.PI / 2, Vector3D.AxisZ);
            m.Translate(5, 0, 0);
            m.wireVertices = BuildWire(length1).ToArray();
            vp.Entities.Add(m, System.Drawing.Color.Red);

            MyHybridMesh m2 = (MyHybridMesh)m.Clone();

            m2.Rotate(Math.PI, Vector3D.AxisZ);
            m2.Translate(60, 0, 0);
            vp.Entities.Add(m2, System.Drawing.Color.Red);

            double       length2 = 60;
            MyHybridMesh m3      = profile.ExtrudeAsMesh <MyHybridMesh>(new Vector3D(0, 0, length2), 0.1, Mesh.natureType.Plain);

            m3.Rotate(Math.PI / 2, Vector3D.AxisZ);
            m3.Translate(5, 0, 0);
            m3.wireVertices = BuildWire(length2).ToArray();
            m3.Rotate(Math.PI / 2, Vector3D.AxisY);
            m3.Translate(0, 0, length1);
            vp.Entities.Add(m3, System.Drawing.Color.Green);
        }