Exemplo n.º 1
0
        /// <summary>
        /// Draws a point cloud of 80x80 vertices
        /// </summary>
        public FastPointCloud FunctionPlot()
        {
            int   rows  = 80;
            int   cols  = 80;
            float scale = 4f;

            PointCloud surface = new PointCloud(rows * cols, 3, PointCloud.natureType.Multicolor);

            for (int j = 0; j < rows; j++)
            {
                for (int i = 0; i < cols; i++)
                {
                    float x = i / 5f;
                    float y = j / 5f;

                    float f = 0;

                    float den = (float)Math.Sqrt(x * x + y * y);

                    if (den != 0)
                    {
                        f = scale * (float)Math.Sin(Math.Sqrt(x * x + y * y)) / den;
                    }

                    surface.Vertices[i + j * cols] = new PointRGB(x, y, f, MyFastPointCloud.BaseColor, MyFastPointCloud.BaseColor, MyFastPointCloud.BaseColor);
                }
            }

            MyFastPointCloud surfaceFast = new MyFastPointCloud(surface.ConvertToFastPointCloud(), model1);

            surfaceFast.LineWeightMethod = colorMethodType.byEntity;
            surfaceFast.LineWeight       = 2;

            return(surfaceFast);
        }