public PendulumData Clone()
        {
            PendulumData data = MemberwiseClone() as PendulumData;

            data.PoincarePoints = new List <PoincarePoint>(PoincarePoints);
            return(data);
        }
        public Trajectory(PendulumData data)
            : base(8)
        {
            Data = data;

            //--- setup the material brush
            LinearGradientBrush brush = new LinearGradientBrush(new GradientStopCollection
            {
                new GradientStop(Colors.Red, 0),
                new GradientStop(Colors.Green, 0.1),
                new GradientStop(Colors.Blue, 0.2),
                new GradientStop(Colors.Goldenrod, 0.3),
                new GradientStop(Colors.Cyan, 0.4),
                new GradientStop(Colors.Magenta, 0.5),
                new GradientStop(Colors.Yellow, 0.6),
                new GradientStop(Colors.Firebrick, 0.7),
                new GradientStop(Colors.LimeGreen, 0.8),
                new GradientStop(Colors.LightBlue, 0.9),
                new GradientStop(Colors.Orange, 1)
            }, 0);

            brush.Freeze();
            DiffuseMaterial.Brush = brush;

            //--- setup the cross section of the tube
            double radius = 0.01;

            for (int id = 0; id < divisions; id++)
            {
                double phi = id * MathUtils.PIx2 / divisions;
                Section.Add(new Point(radius * Math.Cos(phi), radius * Math.Sin(phi)));
            }
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        public Simulator()
        {
            worker = new BackgroundWorker();
            worker.WorkerReportsProgress      = true;
            worker.WorkerSupportsCancellation = true;

            worker.DoWork          += Worker_DoWork;
            worker.ProgressChanged += Worker_ProgressChanged;

            data = new PendulumData();
            data.NewPoincarePoint += Data_NewPoincarePoint;
        }
        void ShowData(PendulumData data, bool bigPoints)
        {
            if (data.PoincarePoints.Count == 0)
            {
                return;
            }

            bitmap.Lock();

            foreach (var point in data.PoincarePoints)
            {
                AddPoint(point, data.Color, bigPoints);
            }

            bitmap.Unlock();
        }