interppolygon

INTERPPOLYGON Interpolates a polygon.
ダウンロード: 1.6K
更新 2009/2/11

ライセンスの表示

Y = INTERPPOLYGON(X,N) interporpolates a polygon whose coordinates are given in X over N points, and returns it in Y.

The polygon X can be of any dimension (2D, 3D, ...), and coordinates are expected to be along columns. For instance, if X is 10x2 matrix (2D polygon of 10 points), then Y = INTERPPOLYGON(X,50) will return a 50x2 matrix.

INTERPPOLYGON uses interp1 for interpolation. The interpolation method can be specified as 3rd argument, as in Y=INTERPPOLYGON(X,N,'method'). Allowed methods are 'nearest', 'linear', 'spline' (the default), 'pchip', 'cubic' (see interp1).

ALGORITHM
The point to point distance array is used to build a metric, which will be interpolated by interp1 over the given number of points. Interpolated points are thus equally spaced only in the linear case, not in other cases where interpolated points do not lie on the initial polygon. If this is an issue, try caalling INTERPPOLYGON twice, as in:
>> Y = INTERPPOLYGON(X,50); % Make a spline interpolation%
>> Z = INTERPPOLYGON(Y,50); % Will correct for uneven space between points

OUTPUT
On top of the interpolated polygon, [Y M] = INTERPPOLYGON(X,N) will return in M the metric of the original polygon.

EXAMPLE
X = rand(5,2);
Y = interppolygon(X,50);
figure, hold on
plot(X(:,1),X(:,2),'ko-')
plot(Y(:,1),Y(:,2),'r.-')

引用

Jean-Yves Tinevez (2024). interppolygon (https://www.mathworks.com/matlabcentral/fileexchange/22948-interppolygon), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2008a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersInterpolation についてさらに検索
タグ タグを追加
謝辞

ヒントを与えたファイル: pencilROI

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0