Hi @Dav that's is interesting alternate calculation.
We could shave some time:
We could shave some time:
Code: (Select All)
Screen _NewImage(1000, 600, 32)
DefLng A-Z
Randomize Timer
Do
Points = Rnd * 70 + 10
ReDim PointX(Points), PointY(Points), PointR(Points), PointG(Points), PointB(Points)
For p = 1 To Points
PointX(p) = Rnd * _Width
PointY(p) = Rnd * _Height
PointR(p) = Rnd * 255
PointG(p) = Rnd * 255
PointB(p) = Rnd * 255
Next
For x = 0 To _Width - 1
For y = 0 To _Height - 1
min = _Hypot(x - PointX(1), y - PointY(1))
closest = 1
For p = 1 To Points
dis = _Hypot(x - PointX(p), y - PointY(p))
If dis < min Then
min = dis: closest = p
End If
Next
PSet (x, y), _RGB(PointR(closest) - min, PointG(closest) - min, PointB(closest) - min)
Next
Next
_Display
_Limit 5
Loop Until _KeyDown(27)
Sleep
b = b + ...