image target; target.open("result.png"); target.new(800, 800); int nr_points = 6; point points[nr_points]; color colors[nr_points]; points[0] = Point(200,200); colors[0] = Color(255,0,0); points[1] = Point(600,300); colors[1] = Color(100,255,0); points[2] = Point(300,600); colors[2] = Color(0,0,255); points[3] = Point(400,200); colors[3] = Color(255,0,0); points[4] = Point(500,500); colors[4] = Color(0,0,0); points[5] = Point(350,700); colors[5] = Color(0,255,255); for x from 0 to 800 for y from 0 to 800 { point p = Point(x, y); double dist[nr_points]; for i from 0 to nr_points dist[i] = distance(points[i], p); color col; for i from 0 to nr_points { double factor = 1.0; for j from 0 to nr_points if (i != j) { factor *= dist[j]; } color coli = colors[i]; coli *= factor * sqrt(factor); col += coli; } target.setColor(x, y, col); }