Beispiel #1
0
 public void Reset(double ratio, double r, bool createModel)
 {
     R = r;
     //https://zh.wikipedia.org/wiki/轉動慣量列表
     endPoints = new List <double>();
     endPoints.Add(0);
     endPoints.Add(Math.PI / (2 + ratio));
     endPoints.Add(Math.PI * (1 + ratio) / (2 + ratio));
     endPoints = endPoints.Concat(endPoints.Select(a => a + Math.PI)).ToList();
     I         = M * GetI(endPoints.Select(a => new Tuple <double, double>(r * Math.Cos(a), r * Math.Sin(a))).ToList());
     if (createModel)
     {
         model  = CreateHex(endPoints, r, r / 2);
         origin = new MyTrans(model);
     }
 }
Beispiel #2
0
        public void Reset(double x, double z, bool createModel)
        {
            W = x; H = z;
            //https://zh.wikipedia.org/wiki/轉動慣量列表
            I = M / 12 * (W * W + H * H);
            var cube = CreateCube(x, 2, z);

            cube.Transform = new MyTrans(cube).Translate(new Vector3D(-x / 2, -1, -z / 2)).Value;
            if (createModel)
            {
                model = new Model3DGroup();
                model.Children.Add(cube);
                model.Children.Add(CreateModel(new SolidColorBrush(Colors.Red), new Point3D(x * 0.2, 0, -z * 0.6), new Point3D(-x * 0.2, 0, -z * 0.6), new Point3D(0, 0, -z * 0.8)));
                origin = new MyTrans(model);
            }
        }