MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / CubicTriInterpolator

Class CubicTriInterpolator

lib/matplotlib/tri/_triinterpolate.py:286–573  ·  view source on GitHub ↗

r""" Cubic interpolator on a triangular grid. In one-dimension - on a segment - a cubic interpolating function is defined by the values of the function and its derivative at both ends. This is almost the same in 2D inside a triangle, except that the values of the function and it

Source from the content-addressed store, hash-verified

284
285
286class CubicTriInterpolator(TriInterpolator):
287 r"""
288 Cubic interpolator on a triangular grid.
289
290 In one-dimension - on a segment - a cubic interpolating function is
291 defined by the values of the function and its derivative at both ends.
292 This is almost the same in 2D inside a triangle, except that the values
293 of the function and its 2 derivatives have to be defined at each triangle
294 node.
295
296 The CubicTriInterpolator takes the value of the function at each node -
297 provided by the user - and internally computes the value of the
298 derivatives, resulting in a smooth interpolation.
299 (As a special feature, the user can also impose the value of the
300 derivatives at each node, but this is not supposed to be the common
301 usage.)
302
303 Parameters
304 ----------
305 triangulation : `~matplotlib.tri.Triangulation`
306 The triangulation to interpolate over.
307 z : (npoints,) array-like
308 Array of values, defined at grid points, to interpolate between.
309 kind : {'min_E', 'geom', 'user'}, optional
310 Choice of the smoothing algorithm, in order to compute
311 the interpolant derivatives (defaults to 'min_E'):
312
313 - if 'min_E': (default) The derivatives at each node is computed
314 to minimize a bending energy.
315 - if 'geom': The derivatives at each node is computed as a
316 weighted average of relevant triangle normals. To be used for
317 speed optimization (large grids).
318 - if 'user': The user provides the argument *dz*, no computation
319 is hence needed.
320
321 trifinder : `~matplotlib.tri.TriFinder`, optional
322 If not specified, the Triangulation's default TriFinder will
323 be used by calling `.Triangulation.get_trifinder`.
324 dz : tuple of array-likes (dzdx, dzdy), optional
325 Used only if *kind* ='user'. In this case *dz* must be provided as
326 (dzdx, dzdy) where dzdx, dzdy are arrays of the same shape as *z* and
327 are the interpolant first derivatives at the *triangulation* points.
328
329 Methods
330 -------
331 `__call__` (x, y) : Returns interpolated values at (x, y) points.
332 `gradient` (x, y) : Returns interpolated derivatives at (x, y) points.
333
334 Notes
335 -----
336 This note is a bit technical and details how the cubic interpolation is
337 computed.
338
339 The interpolation is based on a Clough-Tocher subdivision scheme of
340 the *triangulation* mesh (to make it clearer, each triangle of the
341 grid will be divided in 3 child-triangles, and on each child triangle
342 the interpolated function is a cubic polynomial of the 2 coordinates).
343 This technique originates from FEM (Finite Element Method) analysis;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…