is the algorithm to calculate the original function in that picture in the first place, provided data points with weights.
It's possible. If you start with single points you will always end up with circles, but if you weight the datapoints and take that into account you can squish the circles into ovals as in the image..
The reason you're ending up with polygons is that you're using a discrete function in your calculation - first you find the closest color, then you determine the color.
You should instead look into gradient algorithms that assigns a color for a point based on the distance and weight from the three datapoints which enclose that point in a triangle.
Gradient algorithm
It depends on what you're trying to display. A simplistic algorithm would be:
For each pixel:
- Find the three points which form the smallest triangle that surround this pixel
Set this point to the color (HSV color system) that is affected by both the weight and distance to each datapoint:
pixel.color = datapoint[1].weight * distance(pixel, datapoint[1]) * datapoint[1].color + datapoint[2].weight * distance(pixel, datapoint[2]) * datapoint[2].color + datapoint[3].weight * distance(pixel, datapoint[3]) * datapoint[3].color
I'm using + here, but you need to determine the 'averaging' algorithm suitable for your application.