How to make Rounded Edges of rectangle corners with polyshape function ?
이전 댓글 표시
hello, everybody
I would like to make the rounded rectangle and I would like them to translated and rotated.
First I tried with rectangle function using 'Curvature' of 1. then I can make the rounded rectangle.
However, it is not possible for them to translated and rotated.
Therefore, I made the rectangle with polyshape function. and it is okay for them to translated and rotated.
However, i do not know how I can make them to have rounded edges.
Could you please helpe me how to make them to rounded edges with polyshape function?
clear; close all; clc;
figure(1); hold on; axis equal
% Before translating and rotating
rectangle('Position',[-14.1276, 226.1976, 6.5929, 9.4184],'FaceColor','r','Curvature',1)
% After translating and rotating
% translate and rotate polygon
x = [-14.1276; -14.1276+6.5929; -14.1276+6.5929; -14.1276];
y = [226.1976; 226.1976; 226.1976+9.4184; 226.1976+9.4184];
p = [x,y];
pgon = polyshape(p);
pgon = translate(pgon,50,-75);
pgon = rotate(pgon,18,[57, 349]);
plot(pgon,'FaceColor','red','FaceAlpha',1)
% object by rectangle function can not translated and rotated.
댓글 수: 1
"However, it is not possible for them to translated and rotated."
fh0 = figure();
rh0 = rectangle('Position',[-14.1276, 226.1976, 6.5929, 9.4184],'FaceColor','r','Curvature',1);
axis equal
fh1 = figure();
ax1 = axes(fh1);
rh1 = copyobj(rh0,ax1);
axis equal
c = [57,349];
m = makehgtform('translate',[50,-75,0],...
'translate',[-c,0], 'zrotate',deg2rad(18), 'translate',[c,0]);
ht = hgtransform('Matrix',m);
set(rh1, 'Parent',ht)
채택된 답변
추가 답변 (1개)
S M Ragib Shahriar Islam
2022년 12월 19일
0 개 추천
Hi, I was also searching for similar type of solution. This following link might help you....
카테고리
도움말 센터 및 File Exchange에서 Polygonal Shapes에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


