public dynDynamicRelaxationOnFace()
        {
            InPortData.Add(new PortData("face", "The face to use for distribution of particles.", typeof(Value.Container)));
            InPortData.Add(new PortData("d", "Dampening.", typeof(Value.Number)));
            InPortData.Add(new PortData("s", "Spring Constant.", typeof(Value.Number)));
            InPortData.Add(new PortData("r", "Rest Length.", typeof(Value.Number)));
            InPortData.Add(new PortData("m", "Nodal Mass.", typeof(Value.Number)));
            InPortData.Add(new PortData("numU", "Number of Particles in U.", typeof(Value.Number)));
            InPortData.Add(new PortData("numV", "Number of Particles in V.", typeof(Value.Number)));
            InPortData.Add(new PortData("gravity", "Gravity in Z.", typeof(Value.Number)));

            OutPortData.Add(new PortData("ps", "Particle System", typeof(Value.Container)));
            RegisterAllPorts();

            particleSystem = new ParticleSystem();
        }
Exemple #2
0
        public override Value Evaluate(FSharpList<Value> args)
        {
            var input = args[0];

            NodeUI.Dispatcher.Invoke(new Action(
               delegate
               {
                    //If we are receiving a list, we test to see if they are XYZs or curves and then make Preview3d elements.
                    if (input.IsList)
                    {
                        DetachVisuals();
                        ClearPointsCollections();

                        DrawList(input);
                    }
                    else if (input.IsContainer) //if not a list, try to cast to either a particle system, curve, or xyz
                    {
                        var test = ((Value.Container)(input)).Item;

                        if (test is ParticleSystem)
                        {
                            ps = (ParticleSystem)test;

                            try
                            {
                                UpdateVisualsFromParticleSystem();
                                RaisePropertyChanged("Points");
                            }
                            catch (Exception e)
                            {
                                Bench.Log("Something wrong drawing 3d preview. " + e.ToString());
                            }
                        }
                        else if (test is Curve)
                        {
                            DetachVisuals();
                            ClearPointsCollections();

                            c = (Curve)test;
                            DrawCurve(c);
                            RaisePropertyChanged("Points");
                        }
                        else if (test is XYZ)
                        {

                            DetachVisuals();
                            ClearPointsCollections();

                            pt = (XYZ)test;
                            DrawCurve(c);
                            RaisePropertyChanged("Points");
                        }
                    }
               }));

            return input; //watch 3d should be a 'pass through' node
        }
 public VerletIntegrator(ParticleSystem ps)
 {
     s = ps;
 }
        public dynDynamicRelaxation()
        {
            InPortData.Add(new PortData("points", "The points to use as fixed nodes.", typeof(Value.List)));
            InPortData.Add(new PortData("d", "Dampening.", typeof(Value.Number)));
            InPortData.Add(new PortData("s", "Spring Constant.", typeof(Value.Number)));
            InPortData.Add(new PortData("r", "Rest Length.", typeof(Value.Number)));
            InPortData.Add(new PortData("m", "Nodal Mass.", typeof(Value.Number)));
            InPortData.Add(new PortData("numX", "Number of Particles in X.", typeof(Value.Number)));
            InPortData.Add(new PortData("numY", "Number of Particles in Y.", typeof(Value.Number)));
            InPortData.Add(new PortData("gravity", "Gravity in Z.", typeof(Value.Number)));

            OutPortData.Add(new PortData("ps", "Particle System", typeof(ParticleSystem)));

            RegisterAllPorts();

            particleSystem = new ParticleSystem();
        }
        private void ResetSystem(FSharpList<Value> points, FSharpList<Value> curves)
        {
            if (points == null || curves == null)
                return;

            //particleSystem.Clear();
            particleSystem = null;
            particleSystem = new ParticleSystem();

            _fixPtCount = points.Count();

            particleSystem.setConverged(false);
            particleSystem.setGravity(_g);
            particleSystem.setThreshold(_threshold);

            CreateSpringsFromCurves(curves, points);

            DispatchOnUIThread(new Action(dynSettings.Controller.RequestClearDrawables));

            _reset = false;
        }
        public Integrator(ParticleSystem s)
        {

        }
        public dynDynamicRelaxation()
        {
            InPortData.Add(new PortData("points", "The points to use as fixed nodes.", typeof(Value.List)));
            InPortData.Add(new PortData("curves", "Curves to use as springs.", typeof(Value.List)));
            InPortData.Add(new PortData("d", "Dampening.", typeof(Value.Number)));
            InPortData.Add(new PortData("s", "Spring constant.", typeof(Value.Number)));
            InPortData.Add(new PortData("rl", "Rest length.", typeof(Value.Number)));
            InPortData.Add(new PortData("use_rl", "Should the rest length be considered (true), or should we use the rest length factor instead (false)?.", typeof(Value.Number)));
            InPortData.Add(new PortData("rlf", "Rest length factor. If use rest length factor is set to false," +
                " rest length will be ignored and this factor will be used to determine the rest length as a factor of the spring's initial size.", typeof(Value.Number)));
            InPortData.Add(new PortData("m", "Nodal Mass.", typeof(Value.Number)));
            InPortData.Add(new PortData("gravity", "Gravity in Z.", typeof(Value.Number)));
            InPortData.Add(new PortData("threshold", "The convergence threshold. When the maximum nodal velocity falls below this number, the particle system is flagged \"converged\".", typeof(Value.Number)));

            OutPortData.Add(new PortData("ps", "Particle System", typeof(ParticleSystem)));
            OutPortData.Add(new PortData("f", "Member forces.", typeof(Value.List)));

            RegisterAllPorts();

            particleSystem = new ParticleSystem();
        }
Exemple #8
0
        public override Value Evaluate(FSharpList<Value> args)
        {
            var input = args[0];

            NodeUI.Dispatcher.Invoke(new Action(
               delegate
               {
                    //If we are receiving a list, we test to see if they are XYZs or curves and then make Preview3d elements.
                    if (input.IsList)
                    {
                        #region points and curves
                        //FSharpList<Value> list = ((Value.List)args[0]).Item;
                        var inList = (input as Value.List).Item;

                        DetachVisuals();
                        ClearPointsCollections();

                        //test the first item in the list.
                        //if it's an XYZ, assume XYZs for the list
                        //create points. otherwise, create curves
                        XYZ ptTest = (inList.First() as Value.Container).Item as XYZ;
                        Curve cvTest = (inList.First() as Value.Container).Item as Curve;

                        if (ptTest != null) isDrawingPoints = true;

                        foreach (Value e in inList)
                        {
                            if (isDrawingPoints)
                            {
                                pt = (e as Value.Container).Item as XYZ;
                                DrawPoint(pt);
                            }
                            else
                            {
                                c = (e as Value.Container).Item as Curve;
                                DrawCurve(c);

                            }
                        }
                        RaisePropertyChanged("Points");
                        #endregion
                    }
                    else if (input.IsContainer) //if not a list, try to cast to either a particle system, curve, or xyz
                    {
                        var test = ((Value.Container)(input)).Item;

                        if (test is ParticleSystem)
                        {
                            ps = (ParticleSystem)test;

                            try
                            {

                                UpdateVisualsFromParticleSystem();

                                RaisePropertyChanged("Points");

                            }
                            catch (Exception e)
                            {
                                Bench.Log("Something wrong drawing 3d preview. " + e.ToString());
                            }
                        }
                        else if (test is Curve)
                        {
                            DetachVisuals();
                            ClearPointsCollections();

                            c = (Curve)test;
                            DrawCurve(c);
                            RaisePropertyChanged("Points");
                        }
                        else if (test is XYZ)
                        {

                            DetachVisuals();
                            ClearPointsCollections();

                            pt = (XYZ)test;
                            DrawCurve(c);
                            RaisePropertyChanged("Points");
                        }
                    }
               }));

            return input; //watch 3d should be a 'pass through' node
        }
        public dynDynamicRelaxation()
        {
            InPortData.Add(new PortData("points", "The points to use as fixed nodes.", typeof(object)));
            InPortData.Add(new PortData("curves", "The curves to make into spring chains", typeof(object)));
            InPortData.Add(new PortData("d", "Dampening.", typeof(double)));
            InPortData.Add(new PortData("s", "Spring Constant.", typeof(double)));
            InPortData.Add(new PortData("r", "Rest Length.", typeof(double)));
            InPortData.Add(new PortData("m", "Nodal Mass.", typeof(double)));
            InPortData.Add(new PortData("numX", "Number of Particles in X.", typeof(int)));
            InPortData.Add(new PortData("numY", "Number of Particles in Y.", typeof(int)));
            InPortData.Add(new PortData("gravity", "Gravity in Z.", typeof(double)));

            OutPortData.Add(new PortData("ps", "Particle System", typeof(ParticleSystem)));

            NodeUI.RegisterAllPorts();

            particleSystem = new ParticleSystem();
        }
Exemple #10
0
        private void ResetSystem(IEnumerable<XYZ> points, IEnumerable<Curve> curves)
        {
            if (points == null || curves == null)
                return;

            //particleSystem.Clear();
            ParticleSystem = null;
            ParticleSystem = new ParticleSystem();

            fixPtCount = points.Count();

            ParticleSystem.setConverged(false);
            ParticleSystem.setGravity(g);
            ParticleSystem.setThreshold(threshold);

            CreateSpringsFromCurves(curves, points);

            DispatchOnUIThread(dynSettings.Controller.RequestClearDrawables);
        }
Exemple #11
0
 internal ParticleSystemBase()
 {
     ParticleSystem = new ParticleSystem();
 }