void OnDragPlaneChanged(object sender, EventArgs e)
        {
            List <NVector3DD> intersections3D = m_SurfaceSeries.Get3DIntersections(new NPointD(m_DragPlane.PointA.X, m_DragPlane.PointA.Z), new NPointD(m_DragPlane.PointB.X, m_DragPlane.PointB.Z));
            List <NVector2DD> intersections2D = m_SurfaceSeries.Get2DIntersections(new NPointD(m_DragPlane.PointA.X, m_DragPlane.PointA.Z), new NPointD(m_DragPlane.PointB.X, m_DragPlane.PointB.Z));

            m_CrossSection3DSeries.ClearDataPoints();

            for (int i = 0; i < intersections3D.Count; i++)
            {
                NVector3DD intersection3D = intersections3D[i];

                m_CrossSection3DSeries.Values.Add(intersection3D.Z + 1);
                m_CrossSection3DSeries.XValues.Add(intersection3D.X);
                m_CrossSection3DSeries.ZValues.Add(intersection3D.Y);
            }

            m_CrossSection2DSeries.ClearDataPoints();

            for (int i = 0; i < intersections2D.Count; i++)
            {
                NVector2DD intersection2D = intersections2D[i];

                m_CrossSection2DSeries.Values.Add(intersection2D.Y);
                m_CrossSection2DSeries.XValues.Add(intersection2D.X);
            }

            nChartControl1.Refresh();
        }
        private void GenerateDateTimeData(NLineSeries s, int nCount)
        {
            s.ClearDataPoints();
            DateTime   dateTime = DateTime.Now.AddMilliseconds(-nCount * nChartControl1.AsyncRefreshInterval);
            double     dPrev    = 100;
            double     value;
            NDataPoint dataPoint;

            for (int i = 0; i < nCount; i++)
            {
                GenerateDataPoint(dPrev, new NRange1DD(50, 350), out value);
                dataPoint = new NDataPoint(value);
                s.AddDataPoint(dataPoint);
                dPrev    = (double)s.Values[s.Values.Count - 1];
                dateTime = dateTime.AddMilliseconds(nChartControl1.AsyncRefreshInterval);
                s.XValues.Add(dateTime);
            }
        }
Пример #3
0
        private void ChangeData()
        {
            if (nChartControl1 == null)
            {
                return;
            }

            // add xy values
            float fSpringHeight = 20;
            int   nWindings     = (int)WindingsNumericUpDown.Value;
            int   nComplexity   = (int)ComplexityNumericUpDown.Value;

            double dCurrentAngle = 0;
            double dCurrentHeight = 0;
            double dX, dY, dZ;

            float fHeightStep   = fSpringHeight / (nWindings * nComplexity);
            float fAngleStepRad = (float)(((360 / nComplexity) * 3.1415926535f) / 180.0f);

            NLineSeries line = (NLineSeries)nChartControl1.Charts[0].Series[0];

            line.ClearDataPoints();

            while (nWindings > 0)
            {
                for (int i = 0; i < nComplexity; i++)
                {
                    dZ = Math.Cos(dCurrentAngle) * (dCurrentHeight);
                    dX = Math.Sin(dCurrentAngle) * (dCurrentHeight);
                    dY = dCurrentHeight;

                    line.Values.Add(dY);
                    line.XValues.Add(dX);
                    line.ZValues.Add(dZ);

                    dCurrentAngle  += fAngleStepRad;
                    dCurrentHeight += fHeightStep;
                }

                nWindings--;
            }

            nChartControl1.Refresh();
        }