private void PlaneValueNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            double             value   = (double)PlaneValueNumericUpDown.Value;
            NGridSurfaceSeries surface = nChartControl1.Charts[0].Series[1] as NGridSurfaceSeries;

            if (surface.Isolines.Count > 0)
            {
                surface.Isolines[0].Value = value;
            }

            m_CrossSectionPlane.Value = value;

            NLevelPath path = surface.GetContourForValue(value);

            m_ContourLineSeries.XValues.Clear();
            m_ContourLineSeries.ZValues.Clear();
            m_ContourLineSeries.Values.Clear();

            foreach (NLevelContour contour in path)
            {
                if (contour.Count > 0)
                {
                    int index      = m_ContourLineSeries.XValues.Count + 1;
                    int pointCount = contour.Count;
                    for (int i = 0; i < pointCount; i++)
                    {
                        NPointD point = contour[i];
                        m_ContourLineSeries.XValues.Add(point.X);
                        m_ContourLineSeries.ZValues.Add(point.Y);
                        m_ContourLineSeries.Values.Add(0);
                    }

                    m_ContourLineSeries.XValues.Add(m_ContourLineSeries.XValues[index]);
                    m_ContourLineSeries.ZValues.Add(m_ContourLineSeries.ZValues[index]);
                    m_ContourLineSeries.Values.Add(0);

                    m_ContourLineSeries.XValues.Add(double.NaN);
                    m_ContourLineSeries.ZValues.Add(double.NaN);
                    m_ContourLineSeries.Values.Add(double.NaN);
                }
            }

            nChartControl1.Refresh();
        }
        /// <summary>
        /// Generates random data
        /// </summary>
        /// <param name="pointSeries"></param>
        /// <param name="heatMapSeries"></param>
        private void GenerateData(NPointSeries pointSeries, NTriangulatedHeatMapSeries heatMapSeries)
        {
            NPointD[] points          = new NPointD[] { new NPointD(0.1, 0.1), new NPointD(1.5, 1.0), new NPointD(2.5, 5), new NPointD(4, 0), new NPointD(2.5, 3.4), new NPointD(1.3, 5) };
            double[]  pointsIntensity = new double[] { 30, 10, 30, 20, 40, 20 };

            Random rand = new Random();

            for (double x = 0.0; x <= 5; x += 0.5)
            {
                for (double y = 0.0; y <= 5; y += 0.5)
                {
                    double pointX;
                    double pointY;

                    if (x == 0 || y == 0 || x == 5 || y == 5)
                    {
                        pointX = x;
                        pointY = y;
                    }
                    else
                    {
                        pointX = x + rand.NextDouble() * 0.2;
                        pointY = y + rand.NextDouble() * 0.2;
                    }

                    double intensity = 0;
                    for (int i = 0; i < points.Length; i++)
                    {
                        double dx = points[i].X - pointX;
                        double dy = points[i].Y - pointY;

                        double distance = Math.Sqrt(dx * dx + dy * dy);
                        intensity += pointsIntensity[i] / (1 + distance * distance);
                    }

                    heatMapSeries.Values.Add(intensity);
                    heatMapSeries.XValues.Add(pointX);
                    heatMapSeries.YValues.Add(pointY);
                }
            }

            pointSeries.Values.AddRange(heatMapSeries.YValues);
            pointSeries.XValues.AddRange(heatMapSeries.XValues);
        }
        private void GenerateData()
        {
            NPointD[] points          = new NPointD[] { new NPointD(3.1, 0.1), new NPointD(1.5, 2.0), new NPointD(1.5, 0.5), new NPointD(2, 0), new NPointD(1.5, 3.4), new NPointD(1.3, 3) };
            double[]  pointsIntensity = new double[] { 30, 10, 30, 20, 40, 20 };

            Random rand = new Random();

            for (double x = 0.0; x <= 5; x += 0.5)
            {
                for (double y = 0.0; y <= 5; y += 0.5)
                {
                    double pointX;
                    double pointY;

                    if (x == 0 || y == 0 || x == 5 || y == 5)
                    {
                        pointX = x;
                        pointY = y;
                    }
                    else
                    {
                        pointX = x + rand.NextDouble() * 0.2;
                        pointY = y + rand.NextDouble() * 0.2;
                    }

                    double intensity = 0;
                    for (int i = 0; i < points.Length; i++)
                    {
                        double dx = points[i].X - pointX;
                        double dy = points[i].Y - pointY;

                        double distance = Math.Sqrt(dx * dx + dy * dy);
                        intensity += pointsIntensity[i] / (1 + distance * distance);
                    }

                    m_HeatMap.Values.Add(intensity);
                    m_HeatMap.XValues.Add(pointX);
                    m_HeatMap.YValues.Add(pointY);
                }
            }
        }