Take a look at this for how to scan thru the points in a geoshape/geotrace, using a repeat.
Also, look at the min() function (in addition to your distance() calculation). That may basically tell you the furthest a single point is from your geotrace points encompassed by the repeat [notwithstanding that the minimum distance from a point A to two other points B & C is, in almost all cases, greater than the minimum distance between A and the line B-C joining them…]