Beispiel #1
0
        public cPartSys()
        {
            pS0 =new List<cPart>();
            pS1 =new List<cPart>();
            pS0dot =new List<cPart>();
            pS1dot =new List<cPart>();
            pSMdot =new List<cPart>();

            pF0 = new List<cForcer>();
            ps = new cPart();
            fo = new cForcer();

            partCount = 3000;
            forcerCount = 0;
            wallCount = 0;
            runNotStep = false;
            timeStep = 0.001f;
            fo.gravConst = 10;
            Random randi = new Random();

            double rad = 0;

            for (int i = 0; i < partCount; i++)
            {
                cPart t = new cPart();

                t.age = randi.NextDouble();

                t.Position = new Vector3(0, -1, 0); //initial position of smoke,fire,fountain;

                #region position values for other effetcts

                ///////rain/////////////////
                //t.Position = new Vector3((float)(-2 + 4 * randi.NextDouble()),
                //                         (float)(-2 + 4 * randi.NextDouble()),
                //                         (float)(-2 + 4 * randi.NextDouble()));
                ///////////////////////////

                /////fall/////////////////
                //t.Position = new Vector3(-2.5f,
                //                         (float)(-0.12 + 0.25 * randi.NextDouble()),
                //                         (float)(-0.12 + 0.25 * randi.NextDouble()));
                //////////////////////////

                #endregion

                rad = 1;
                t.mass = rad;

                pS0.Add(t);
            }

            cForcer f = new cForcer();
            forcerCount = 1;
            f.gravConst = 10;
            f.downDir = new Vector3(0,-1,0);//this vector sets the direction in which the particles fall;

            pF0.Add(f);
        }
Beispiel #2
0
        public void stateVecAPlusBTimesC(ref List<cPart> pDest, List<cPart> A, List<cPart> B, float C)
        {
            if (pDest.Count != 0)
            {
                pDest.RemoveRange(0, partCount);
            }

            for (int i = 0; i < partCount; i++)
            {
                cPart temp = new cPart();

                temp.Position = A[i].Position + B[i].Position * C;
                temp.Velocity = A[i].Velocity + B[i].Velocity * C;
                temp.Force = A[i].Force + B[i].Force * C;

                temp.age = A[i].age + B[i].age * C;
                temp.mass = A[i].mass + B[i].mass * C;
                pDest.Add(temp);
            }
        }
Beispiel #3
0
        public void stateVecSwap(ref List<cPart> to, ref List<cPart> from)
        {
            List<cPart> temp1 = new List<cPart>();
            List<cPart> temp2 = new List<cPart>();
            for (int i = 0; i < partCount; i++)
            {
                cPart a = new cPart();
                cPart b = new cPart();

                a.Position = from[i].Position;
                a.Velocity = from[i].Velocity;
                a.Force = from[i].Force;
                a.age = from[i].age;
                a.mass = from[i].mass;

                b.Position = to[i].Position;
                b.Velocity = to[i].Velocity;
                b.Force = to[i].Force;
                b.age = to[i].age;
                b.mass = to[i].mass;

                from.Add(b);
                to.Add(a);
            }

            from.RemoveRange(0, partCount);
            to.RemoveRange(0, partCount);
        }
Beispiel #4
0
        public void dotMaker(ref List<cPart> pDotDest, ref List<cPart> pSrc)
        {
            applyAllForces(ref pSrc);
            stateVecZero(ref pDotDest);;
            for (int i = 0; i < partCount; i++)
            {

                cPart temp = new cPart();

                temp.type = pSrc[i].type;
                temp.age -= 0.08;
                temp.Position = pSrc[i].Velocity;

                temp.Velocity = new Vector3((float)(pSrc[i].Force.X / (nu_epsilon + pSrc[i].mass)),
                                            (float)(pSrc[i].Force.Y / (nu_epsilon + pSrc[i].mass)),
                                            (float)(pSrc[i].Force.Z / (nu_epsilon + pSrc[i].mass)));

                pDotDest.Add(temp);
            }
        }