We have implemented gradient ascent and descent on planar geometry, much like a terrain where we used the gradient of the height.
For an arbitrary geometry, what can we use as the cost attribute? One thing we can use is depth.