rectangle2

버전 2.0.0 (595 KB) 작성자: Adam Danz
Similar to Matlab's rectangle() but with more options.
다운로드 수: 158
업데이트 날짜: 2021/1/11

라이선스 보기

Similar to Matlab's rectangle() function but with these additional features:
* Position rectangles by their center points rather than by their lower left coordinate.
* Supports creation of multiple rectangles with independent properties
* Outputs handles to patch object rather than rectangle
* Outputs rectangles parameters including vertices
* Option to rotate rectangles about their centers

RECTANGLE2(POS) creates rectangles in 2D coordinates. POS is an nx4
matrix [x y w h] specifying the center (x,y), width (w) and height
(h) of n rectangles in data units on the current axes.

RECTANGLE2(CNT, WH) specifies the center, CNT, as an nx2 matrix of
[x,y] coordinates and the size, WH, as an nx2 matrix of widths and
heights. When either CNT or WH is 1x2 and the other is nx2 (n>1),
the 1x2 parameter is replicated for all rectangles.

RECTANGLE2(__,'Curvature',cur) adds curvature to the sides of the
rectangle. Different curvatures along the horizontal and vertical
edges is specified by an nx2 vector for n rectangles. The same length
of curvature will be applied to all sides when cur is a scalar.
Curvature is expressed by values between 0 (no curvature) and 1
(circular/elliptical). If only one row of values is supplied, the
same curvature will be applied to all rectangles.

RECTANGLE2(__,'Rotation',deg) defines the rotation of the rectangle
about its center in degrees. Negative values rotate clockwise. If
only one value is supplied, the same rotation will be applied to
all rectangles.

RECTANGLE2(__,Name,Value) specifies rectangle properties using one
or more Name,Value pair arguments accepted by Matlab's rectangle
function. FaceColor and EdgeColor can be specified for n rectangles
by specifying an nx1 cell of character vectors or an nx3 matrix of
rgb values. LineStyle can also be an nx1 cell of characters. LineWidth
can be an nx1 vector of values for n rectangles.

Postion (POS | CNT & WH) inputs and, if specified, curvature, rotation,
FaceColor, EdgeColor, LineWidth, and LineStyle must either have the same
number of rows or one row to be used for all rectangles.

RECTANGLE2(ax,__) specifies the axes.

[h, rect] = RECTANGLE2(__) returns an nx1 vector of patch handles, h,
for n rectangles and a structure, rect, containing data about the
rectangles.

인용 양식

Adam Danz (2024). rectangle2 (https://www.mathworks.com/matlabcentral/fileexchange/85418-rectangle2), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2020b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
도움

도움 준 파일: rectangles

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
2.0.0

Most inputs including name-val pairs are auto-expanded. Rect.verts is in plotting order. Outputs are suppressed unless requested. Fixed error when detecting Face|Edge props. Using Matlab defaults for missing name-vals. New example file.

1.1.0

Produces patch obj instead of rectangle; specity 1 WH for multiple CNT inputs; accounting for Face vertices; cleaner handling of parent handle and hold-state.

1.0.0