public static Mesh ZFunction(Func <double, double, double> z, UvSampler vertices)
        {
            SurfaceParametricEquation surface = new SurfaceParametricEquation(
                (u, v) => u,
                (u, v) => v,
                (u, v) => z(u, v)
                );

            return(Parametric(surface, vertices));
        }
        public static Mesh Sphere(double radius)
        {
            SurfaceParametricEquation surface = new SurfaceParametricEquation(
                (u, v) => radius * Math.Cos(v) * Math.Cos(u),
                (u, v) => radius * Math.Cos(v) * Math.Sin(u),
                (u, v) => radius * Math.Sin(v)
                );
            UvSampler vertices = new UvSampler(new Interval(0, 2 * Math.PI), new Interval(-0.5 * Math.PI, 0.5 * Math.PI), 25, 31);

            return(Parametric(surface, vertices, true, true));
        }
        public Point3D[,] EvaluateSurface(SurfaceParametricEquation surface)
        {
            var samples = GetSamples();

            Point3D[,] points = new Point3D[UCount, VCount];
            for (int i = 0; i < UCount; i++)
            {
                for (int j = 0; j < VCount; j++)
                {
                    var    sample = samples[i, j];
                    double u      = sample.x;
                    double v      = sample.y;
                    points[i, j] = surface.Evaluate(u, v);
                }
            }

            return(points);
        }
        public static Mesh HorizontalPlane(UvSampler vertices)
        {
            SurfaceParametricEquation surface = new SurfaceParametricEquation();

            return(Parametric(surface, vertices));
        }
        public static Mesh Parametric(SurfaceParametricEquation surface, UvSampler vertices, bool closed0 = false, bool closed1 = false)
        {
            MeshBuilder mb = MeshBuilder.ParametricEquation(surface, vertices, closed0, closed1);

            return(mb.ToMesh());
        }
        public static MeshBuilder ParametricEquation(SurfaceParametricEquation surface, UvSampler vertices, bool closed0 = false, bool closed1 = false)
        {
            var points = vertices.EvaluateSurface(surface);

            return(RectGrid(points, closed0, closed1));
        }