## Interpolate Points on a Shape (interpshape)

version 3.0.0 (245 KB) by
Increases the number of points defining a shape by placing n uniformly spaced points along each line segment connecting existing points.

Updated 29 Aug 2021

From GitHub

# interpshape

Increases the number of points defining a shape by placing uniformly spaced points along each line segment connecting existing points.

## Syntax

[x_new,y_new] = interpshape(x,y,n)

## Description

[x_new,y_new] = interpshape(x,y,n) returns a new set of points stored in the vectors x_new and y_new given an original set of points stored in the vectors x and 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 x and y). The new set of points also includes the original set of points stored in x and y.

• See "EXAMPLES.mlx" or the "Examples" tab on the File Exchange page for examples.

## Comparison to interparc

A similar (and in some cases, more desirable) "shape interpolation" can be achieved using the interparc function. The main differences between interparc and interpshape are:

• [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 x and y. Therefore, .
• [x_new,y_new] = interpshape(x,y,n) returns a new set of coordinates stored in x_new and y_new where 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.

Use interpshape if:

• 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

Use interparc if:

• 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)

### Cite As

Tamas Kis (2022). Interpolate Points on a Shape (interpshape) (https://github.com/tamaskis/interpshape-MATLAB/releases/tag/v3.0.0), GitHub. Retrieved .

##### MATLAB Release Compatibility
Created with R2021a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux