Exemple #1
0
 protected override Model3D CreateModel(params object[] vs)
 {
     SubTransforms.Add(new MatrixTransform3D());
     MyLib.AssertTypes(vs, typeof(Point3D));
     Position = (Point3D)vs[0];
     My3DGraphics.Cuboid.AddFaces(new Point3D(0.1, 0.1, 0.1), out List <Point3D> vertices, out List <int> triangleIndices, out List <Vector3D> normals);
     return(My3DGraphics.NewModel().AddTriangles(vertices, triangleIndices, normals).CreateModel(new SolidColorBrush(Colors.White)));
 }
 public Drill(double radius, double bladeCount) : base(radius, bladeCount)
 {
     SubTransforms.Add(new MatrixTransform3D()); //Withdraw
     SubTransforms.Add(new MatrixTransform3D()); //Rotate
     Kernel.Heart.Beat1 += (secs) =>
     {
         MyLib.Set(SubTransforms, TransformIndexRotate).RotatePrepend(new Vector3D(0, 0, 1), secs * Math.PI).Done();
         UpdateTransform();
     };
 }
                Model3DGroup CreateModel(Description description, double radius)
                {
                    Model3DGroup ans = new Model3DGroup();

                    Blades = new List <Blade>();
                    for (int i = 0; i < description.Count; i++)
                    {
                        var blade = new Blade(description.BladeType, radius, MyLib.ToRad(20), Reversed);
                        blade.Transform = blade.OriginTransform = MyLib.Transform(blade).Rotate(new Vector3D(0, 0, 1), (Reversed ? -1 : 1) * (AngleOffset + i * 2.0 * Math.PI / description.Count)).Value;
                        Blades.Add(blade);
                        ans.Children.Add(blade.Model);
                    }
                    SubTransforms.Add(new MatrixTransform3D());//theta
                    return(ans);
                }