rectangles

バージョン 1.0.0 (6.86 KB) 作成者: wfH
Efficiently draw a bunch of rectangles with curvatures and rotation.
ダウンロード: 16
更新 2021/5/7

ライセンスの表示

I used to be troubled by efficiently drawing a bunch of rectangles on a figure.
A very useful function `RECTANGLES` wrote by Matthew Eicholtz solved my problems by plotting multiple rectangles as a single patch.
https://www.mathworks.com/matlabcentral/fileexchange/59243-rectangles

However, when I want to add curvatures to the rectangles, Matthew Eicholtz's approach cannot help.
Though his `RECTANGLES` is great, it is needed to be modified.

My `RECTANGLES` follows the same behaviour as builtin function `RECTANGLE` and can draw a bunch of rectangles
1) with different curvatures along the horizontal and vertical sides,
2) with different rotations about their centers.
The computation of curvatures and rotations have been fully vectorized !

Besides, the input position(s) of rectangles could be the four-element vectors [x, y, width, height] or the five-element vectors [xcenter, ycenter, width, height, yaw],
which is compatible with the common usage of bounding box in the field of computer vision.

Syntax: (basic usage)
rectangles(pos) % plot multiple rectangles at the position pos.
rectangles(pos, Name, Value, ...) % plot multiple rectangles at the position pos with properties specified.
rectangles('Position', pos, 'Curvature', cur) % plot multiple rectangles with curvatures
rectangles('Position', pos, 'Rotation', ang) % plot multiple rectangles with rotations
rectangles('Position', pos, Name, Value, ...) % plot multiple rectangles with properties specified.
rectangles(ax, ___)
H = rectangles(___)

Run the code without any input for demo.
See the function header for details.

引用

wfH (2024). rectangles (https://www.mathworks.com/matlabcentral/fileexchange/91840-rectangles), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2020a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
謝辞

ヒントを得たファイル: rectangles, rectangle2

Community Treasure Hunt

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

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