Moving, shrinking, expanding triangle by a fixed amount

How can I write a program in Matlab to move a centre ( C ) of triangle to right or left and to shrink/expand its width (L-R) by a fixed amount?

댓글 수: 2

If you know the initial coordinates, simple addition and multiplication will work. It's trivial. Not sure what part you're unsure of - the math or the programming. And not sure why you tagged this as fuzzy membership.
@Image Analyst: Actually I want to optimize triangular fuzzy MFs using PSO with the logic mentioned in my question. That's why I tagged this as fuzzy membership.

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2020년 6월 17일
Read about Affine Transofrmations.
A =rand(3,2) ; % A random triangle
patch(A(:,1),A(:,2),'r')
% Move center
for i = 1:10
C = rand(1,2) ;
patch(A(:,1)+C(1),A(:,2)+C(2),'r')
drawnow
endfor
title('Center moved')
% Shrinking
Cx = 1/2 ; Cy = 1/2 ;
C = [Cx 0 ; 0 Cy ] ;
B = (A-mean(A))*C+mean(A) ;
figure
patch(A(:,1),A(:,2),'r')
hold on
patch(B(:,1),B(:,2),'b')
title('Shrinking')
% Expanding
Cx = 2 ; Cy = 2 ;
C = [Cx 0 ; 0 Cy ] ;
B = (A-mean(A))*C+mean(A) ;
figure
patch(B(:,1),B(:,2),'b')
hold on
patch(A(:,1),A(:,2),'r')
title('expaning')

카테고리

도움말 센터File Exchange에서 Fuzzy Logic Toolbox에 대해 자세히 알아보기

질문:

2020년 6월 15일

답변:

2020년 6월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by