image thumbnail

Interpolate Points on a Shape (interpshape)

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

10 Downloads

Updated 29 Aug 2021

From GitHub

View license on GitHub

interpshape View Interpolate Points on a Shape (interpshape) on File Exchange

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.

Examples and Additional Documentation

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

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 (2021). 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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.