Creating a linear gradient without knowing the size

I am trying to create a gradient to feed into Libnoise so I can create a heatmap for my procedural world game and I can’t quite come up with a way to create a linear gradient when I don’t know how large the gradient will be.

To use libnoise operators I need to subclass from modulebase which means I need to implement

public override double GetValue(double x, double y, double z)
        {
        
        }

which should return a value between -1 and 1. I can come up with ways to create the gradient if I know the size of the texture but I can’t come up with a method if I don’t know the resolution of the map. Maybe I am looking at this the wrong way and there is a better way to go about this.

So at the moment the ugly hack I am going with is to pass in the size (in one dimension) to the constructor for my gradient and then linearly interpolate between a fixed set of control points. It’s ugly but quick. I’ll post terrible code when I get it working.