I have a mesh generated from cloudpoint, which could be described as z = f(x,y)
, so I'm using scipy.interpolate.bisplrep
and bisplev
, with good results.
bisplev
can be used with parameters dx=n
and/or dy=n
so that the results are derivatives of order n
at the evaluated points. I plan to use this to calculate mean and gaussian curvatures (called surfature
in Matlab), and that should involve getting the second-order partial derivatives of the survace
The results using one of the partial derivatives at a time, say dx
are great, clearly representing the gradient as a "shading" effect, as seen in this image from a human back (code first):
self.spline = inter.bisplrep(self.pointlist[:,1],
self.pointlist[:,0],
self.pointlist[:,2], s=smoothing_factor)
self.mesh_shadow = inter.bisplev(yy.flat, xx.flat, self.spline, dy=1)
So far, so good. The problem is: I can't understand (and can't find any explanation) what's the meaning of the result when I ask for both partial derivatives at the same time, since there isn't any obvious numeric or visual meaning. For example, if I use dx
AND dy
:
self.mesh_shadow = inter.bisplev(yy.flat, xx.flat, self.spline, dx=1, dy=1)
I get this:
So, I wonder:
- What's the mathematical/geometrical meaning of the simultaneous result of first-order partial derivatives of a surface as given by
bislplev(..., dx=1, dy=1)
, if any? - Would there be a way to get the maximum slope (in any direction) from
bislplev(..., dx=1, dy=1)
? - Are both partial derivatives supposed to be called together, in the first place? I see I can use, say,
(..., dx=1, dy=2)
and the function seems to produce "valid" results, but would that make any sense?
Every time, the returned value is a (Y,X)-shaped array of single float values (Z or one of its derivative-related values).
Any help?
Thanks for reading