interpol.triangles¶
-
interpol.
triangles
(anchorpoints: Iterable, anchorvalues: Iterable, outsidevalue=None) → Callable[source]¶ Standard barycentric interpolation (using triangles) near set of points.
Interpolate the value at any point in the plane, if the coordinates and values of a set of anchors is specified. If >3 anchors are specified, the convex hull around them is tessellated with Delaunay triangles.
- Parameters
- anchorpoints
Iterable of anchor point coordinates (x, y).
- anchorvalues
Iterable of floats specifying the known value at each anchor point.
- outsidevalue, optional
Float specifying the value for points outside the hull. If not specified, an attempt at extrapolation is made (default).
- Returns
- Function that accepts coordinates (x, y) of any point in the plane as a
- 2-Iterable, and returns the interpolated value at that point.
Notes
Instead of single floats, the
anchorvalues
may also be iterables of uniform length, e.g. 3- or 4-tuples specifying colors. The interpolation function’s return value has the same length as the anchorvalues.Source: https://stackoverflow.com/questions/57863618/how-to-vectorize-cal culation-of-barycentric-coordinates-in-python