フィルターのクリア

Area of qudrilateral from input vertices (condition error when 3+ points on the same line)

1 回表示 (過去 30 日間)
Petros Tsitouras
Petros Tsitouras 2020 年 6 月 1 日
コメント済み: KSSV 2020 年 6 月 1 日
Hello everyone, I want to implement a condition for the while loop where after checking some other details (vytest), it will check if at least one of the last two vertices (C, D) are on top of the line drawn by the first two (A, B).
else
coef(cnt,:)=polyfit([vx(1) vx(cnt)], [vy(1) vy(cnt)], 1);
while vytest==0||(vy(cnt)==coef(cnt,1)*vx(cnt)+coef(cnt,2) && vy(cnt-1)==coef(cnt-1,1)*vx(cnt-1)+coef(cnt,2))
if vytest==0
fprintf('ERROR: no1\n');
else
fprintf('ERROR: no2\n');
end
temp = input(' Y=');
vytest=isnumeric(temp);
vy(cnt) = temp;
end
end
As to this point I have done the above but with no error turning up when inserted 3+ points of the same line.
A=[vx(1) vy(1)]
B=[vx(2) vy(2)]
C=[vx(3) vy(3)]
D=[vx(4) vy(4)]
and
cnt=1:4
Thanks very much in advance!!
  3 件のコメント
Petros Tsitouras
Petros Tsitouras 2020 年 6 月 1 日
The coefficients for y=a*x+b made by the two points.
I believe that the first output value of the polyfit is "a" and the second is "b".
KSSV
KSSV 2020 年 6 月 1 日
Yes, when you use degree 1, in polyfit; the first one would be a and second one is b.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by