예제 #1
0
        public CalculationBase(InputData inputdata, int pointsCount, bool doStepInPower = true)
        {
            this.inputdata     = inputdata;
            this.doStepInPower = doStepInPower;
            if (inputdata.af > 0)
            {
                inputdata.af = -inputdata.af;
            }

            S = Math.Sqrt(MyMath.SD(inputdata.Xf, inputdata.Xs) + MyMath.SD(inputdata.Yf, inputdata.Ys) + MyMath.SD(inputdata.Zf, inputdata.Zs));

            t1     = inputdata.Vm / inputdata.as_;
            t2     = S / inputdata.Vm - inputdata.Vm / (2 * inputdata.as_) + inputdata.Vm / (2 * inputdata.af);
            t3     = -inputdata.Vm / inputdata.af;
            tf     = t1 + t2 + t3;
            DeltaT = tf / pointsCount;

            start      = new Coordinates(inputdata.Xs, inputdata.Ys, inputdata.Zs);
            finish     = new Coordinates(inputdata.Xf, inputdata.Yf, inputdata.Zf);
            deltaCoord = new Coordinates {
                X = (finish.X - start.X) / pointsCount, Y = (finish.Y - start.Y) / pointsCount, Z = (finish.Z - start.Z) / pointsCount
            };

            Reset();
        }
        public void Set(Coordinates current)
        {
            AA = Math.Sqrt(MyMath.SD(l2 / 2, current.X) + MyMath.SD(l1 / 2, current.Y) + MyMath.SD(H, current.Z));
            BB = Math.Sqrt(MyMath.SD(l2 / 2, current.X) + MyMath.SD(L1 - current.Y, l1 / 2) + MyMath.SD(H, current.Z));
            CC = Math.Sqrt(MyMath.SD(L2 - current.X, l2 / 2) + MyMath.SD(L1 - current.Y, l1 / 2) + MyMath.SD(H, current.Z));
            DD = Math.Sqrt(MyMath.SD(L2 - current.X, l2 / 2) + MyMath.SD(l1 / 2, current.Y) + MyMath.SD(H, current.Z));

            currentZ = current.Z;

            CosA = GetCos(AA);
            CosB = GetCos(BB);
            CosC = GetCos(CC);
            CosD = GetCos(DD);

            SinA = GetSin(AA);
            SinB = GetSin(BB);
            SinC = GetSin(CC);
            SinD = GetSin(DD);
        }
예제 #3
0
        public void Set(Cables cables, Points points, Acceleration a)
        {
            A = cables.SinA * DivSqrt(points.A.X, points.A.X.Squared() + points.A.Y.Squared());
            B = cables.SinB * DivSqrt(points.B.X, points.B.X.Squared() + MyMath.SD(L1, points.B.Y));
            C = cables.SinC * DivSqrt(L2 - points.C.X, MyMath.SD(L2, points.C.X) + MyMath.SD(L1, points.C.Y));
            D = cables.SinD * DivSqrt(L2 - points.D.X, points.D.Y.Squared() + MyMath.SD(L2, points.D.X));

            E = cables.SinA * DivSqrt(points.A.Y, points.A.X.Squared() + points.A.Y.Squared());
            F = cables.SinB * DivSqrt(points.B.Y, points.B.X.Squared() + MyMath.SD(L1, points.B.Y));
            G = cables.SinC * DivSqrt(L1 - points.C.Y, MyMath.SD(L2, points.C.X) + MyMath.SD(L1, points.C.Y));
            H = cables.SinD * DivSqrt(points.D.Y, points.D.Y.Squared() + MyMath.SD(L2, points.D.X));

            I = cables.SinA * DivSqrt(points.A.X * l1 - points.A.Y * l2, points.A.X.Squared() + points.A.Y.Squared()) * 0.5;
            J = cables.SinB * DivSqrt(points.B.X * l1 + points.B.Y * l2, points.B.X.Squared() + MyMath.SD(L1, points.B.Y)) * 0.5;
            var k1 = (L1 - points.C.Y) * l2 - (L2 - points.C.X) * l1;

            K = cables.SinC * DivSqrt(k1, MyMath.SD(L2, points.C.X) + MyMath.SD(L1, points.C.Y)) * 0.5;
            var l = (L2 - points.D.X) * l1 + points.D.Y * l2;

            L = cables.SinD * DivSqrt(l, points.D.Y.Squared() + MyMath.SD(L2, points.D.X)) * 0.5;

            var div = B * E + A * F;

            M = (C * E - A * G) / div;
            N = (D * E + A * H) / div;
            O = (a.X * E - a.Y * A) / div;
            P = (C * F + G * B) / div;
            R = (D * F - H * B) / div;
            S = (a.X * F + a.Y * B) / div;
        }