private void UpdateSystem() { //update the spring values for (int j = 0; j < particleSystem.numberOfSprings(); j++) { ParticleSpring spring = particleSystem.getSpring(j); spring.setDamping(_d); if (!_use_rl) { spring.setRestLength(_r); } spring.setSpringConstant(_s); } for (int j = 0; j < particleSystem.numberOfParticles(); j++) { Particle p = particleSystem.getParticle(j); p.setMass(_m); } }
//public override void Evaluate(FSharpList<Value> args, Dictionary<PortData, Value> outPuts) //{ // _points = ((Value.List)args[0]).Item;//point list // _curves = ((Value.List)args[1]).Item;//spring list // _d = ((Value.Number)args[2]).Item;//dampening // _s = ((Value.Number)args[3]).Item;//spring constant // _r = ((Value.Number)args[4]).Item;//rest length // _useRl = Convert.ToBoolean(((Value.Number)args[5]).Item);//use rest length // _rlf = ((Value.Number)args[6]).Item;//rest length factor // _m = ((Value.Number)args[7]).Item;//nodal mass // _g = ((Value.Number)args[8]).Item;//gravity z component // _threshold = ((Value.Number) args[9]).Item; //convergence threshold // //if we are in the evaluate, this has been // //marked dirty and we should set it to unconverged // //in case one of the inputs has changed. // ParticleSystem.setConverged(false); // ParticleSystem.setGravity(_g); // ParticleSystem.setThreshold(_threshold); // //if the particle system has a different layout, then // //clear it instead of updating // if(ParticleSystem.numberOfParticles() == 0 || // _fixPtCount != _points.Count() || // _curves.Count() != ParticleSystem.numberOfSprings() || // _reset) // { // ResetSystem(_points, _curves); // } // else // { // UpdateSystem(); // } // outPuts[_psPort] = Value.NewContainer(ParticleSystem); // outPuts[_forcesPort] = Value.NewList(Utils.SequenceToFSharpList( // ParticleSystem.Springs.Select(s => Value.NewNumber(s.getResidualForce())))); //} private void UpdateSystem() { //update the spring values for (int j = 0; j < ParticleSystem.numberOfSprings(); j++) { ParticleSpring spring = ParticleSystem.getSpring(j); spring.setDamping(d); if (!useRl) { spring.setRestLength(r); } spring.setSpringConstant(s); } for (int j = 0; j < ParticleSystem.numberOfParticles(); j++) { Particle p = ParticleSystem.getParticle(j); p.setMass(m); } }