Interpolate Points on a Shape (interpshape)
Updated 29 Aug 2021
[x_new,y_new] = interpshape(x,y,n)
[x_new,y_new] = interpshape(x,y,n) returns a new set of points stored in the vectors
y_new given an original set of points stored in the vectors
y. The new set of points has
n points spaced evenly along each line segment forming the perimeter of the shape (which is defined by the points stored in
y). The new set of points also includes the original set of points stored in
- See "EXAMPLES.mlx" or the "Examples" tab on the File Exchange page for examples.
- See "Interpolate_Points_on_a_Shape.pdf" (also included with download) for the technical documentation.
A similar (and in some cases, more desirable) "shape interpolation" can be achieved using the
interparc function. The main differences between
[x_new,y_new] = interparc(n,x,y,'linear')returns points evenly spaced around the perimeter of the shape defined by the coordinates stored in
y. Therefore, .
[x_new,y_new] = interpshape(x,y,n)returns a new set of coordinates stored in
y_newwhere there are new points spaced evenly between each and . Therefore, , where is the original number of points.
Therefore, the two functions are advantageous/disadvantageous in different scenarios, as outlined below.
- you want to add the same number of points along each line segment connecting existing points
- you want the set of new coordinates defining the shape to contain the original set of coordinates
- you want the shape to be defined using a specific number of points spaced evenly around the perimeter
- you want to use a different type of interpolation (such as spline interpolation)
Tamas Kis (2021). Interpolate Points on a Shape (interpshape) (https://github.com/tamaskis/interpshape-MATLAB/releases/tag/v3.0.0), GitHub. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!