Example #1
0
 public ParticleSpring(int ID, Particle particleA, Particle particleB, double restLength, double springConstant, double damping)
 {
     m_ID = ID;
     m_particleA = particleA;
     m_particleB = particleB;
     m_restLength = restLength;
     m_springConstant = springConstant;
     m_Damping = damping;
 }
Example #2
0
        public ParticleSpring makeSpringFromElementID(ElementId eid, Particle a, Particle b, double restLength, double springConstant, double damping)
        {
            bool found = false;
            for (int i = 0; i < springs.Count(); ++i)
            {
                if (eid != null && (springs[i].getElementID() != null))
                {
                    if (eid == springs[i].getElementID())
                    {
                        found = true;
                        return springs[i];

                    }
                }
            }
            if (found == false)
            {
                ParticleSpring s = new ParticleSpring(springID++, eid, a, b, restLength, springConstant, damping);
                springs.Add(s);
                return s;
            }
            return null;
        }
Example #3
0
 public ParticleSpring makeSpring(Particle a, Particle b, double restLength, double springConstant, double damping)
 {
     ParticleSpring s = new ParticleSpring(springID++, a, b, restLength, springConstant, damping);
     springs.Add(s);
     return s;
 }
Example #4
0
        public Particle makeParticleFromXYZ(ElementId eid, double mass, XYZ position, bool fix)
        {
            bool found = false;
            for (int i = 0; i < particles.Count(); ++i)
            {
                if (eid != null && (particles[i].getElementID() != null)&& position!=null)
                {
                    if (position.IsAlmostEqualTo(particles[i].getPosition()))
                    {
                        found = true;
                        particles[i].setPosition(position);
                        return particles[i];

                    }
                }
            }
            if (found == false)//if we did not find one make a new one
            {
                Particle part = new Particle(partID++, eid, mass, position, fix);
                particles.Add(part);
                return part;
            }

            return null;
        }
Example #5
0
        public Particle makeParticle(double mass, XYZ position, bool fix)
        {
            Particle p = new Particle(partID++, mass, position, fix);
            particles.Add(p);

            return p;
        }
Example #6
0
        public ParticleSpring makeOrUpdateSpring(int ID, Particle a, Particle b, double restLength, double springConstant, double damping)
        {
            bool found = false;
            for (int i = 0; i < springs.Count(); ++i)
            {
                if (ID != null && (springs[i].ID() != null))
                {
                    if (ID == springs[i].ID())
                    {
                        found = true;
                        return springs[i];

                    }
                }
            }
            if (found == false)
            {
                ParticleSpring s = new ParticleSpring(ID++, a, b, restLength, springConstant, damping);
                springs.Add(s);
                return s;
            }
            return null;
        }
Example #7
0
        public Particle makeOrUpdateParticle(int ID, double mass, XYZ position, bool fix)
        {
            bool found = false;
            for (int i = 0; i < particles.Count(); ++i)
            {
                if (ID != null && (particles[i].ID() != null))
                {
                    if (ID == particles[i].ID())
                    {
                        found = true;
                        particles[i].setPosition(position);
                        return particles[i];

                    }
                }
            }
            if (found == false)//if we did not find one make a new one
            {
                Particle part = new Particle(ID++, mass, position, fix);
                particles.Add(part);
                return part;
            }

            return null;
        }