# Improve accuracy of mesh gradient?

So to make it simple. I currently use a method I found online to compute the gradient of a scalar field of a mesh.

To test how accurate this is, I made a sphere and followed the gradient direction of the geodesic field to construct a line. That is to say, pick $$p$$ on the sphere and define $$\phi(X)$$ the function that return the geodesic distance between $$X$$ and $$p$$.

By a property of the exponential map described by Manfredo Do Carmo, the geodesic gradient (the tangent) at $$X$$ uniquely describes the geodesic containing both $$X$$ and $$P$$.

In short, if you know the correct tangent at $$X$$ you can just follow that direction in the exponential map and eventually hit the source $$p$$.

So I went and coded exactly that: In that image, the source $$p$$ is at the intersection of the 3 lines in the bottom part of the image. So my line passes very close to it, but it doesn't hit.

My assumption is, this happens because my gradient approximation is quite linearly based and as such even small errors quickly have big effects, especially as the points grow farther apart.

I am wondering if people know of methods or algorithms that can improve the accuracy of the gradient.

I got the formula for the discrete gradient at page 28 here.

• Just a guess off the top of my head, but I wonder if it would help to slerp the gradients instead of lerp? Sep 18 '20 at 16:30
• That may work well on spheres, but this should work on arbitrary meshes. In fact this entire thing is trying to generalize lerping to arbitrary meshes : p Sep 18 '20 at 16:41
• I think that slerping might help for arbitrary meshes as well. Sep 18 '20 at 16:48
• How? I thought slerping isn;t really affine. By that I mean that if I offset my mesh theresults I would get would be different. Sep 18 '20 at 16:52
• I'm imagining that when you interpolate a gradient vector along a triangle edge you do slerp(gradient1, gradient2, t) instead of lerp(gradient1, gradient2, t). It's just a different interpolation function that's sensitive to the angle between the gradients. It doesn't depend on absolute position or orientation of the gradients or the triangle. Sep 18 '20 at 17:05