Plotting triangle and finding its vertices

1 次查看(过去 30 天)
hi!! I want to plot these lines, find the point of intersection formed by these lines. The plot is not intersecting these, though they should graphically. How do I make them intersect and find the vertices formed?
[x1] = input('Enter the value of 1st coord');
[y1] = input('Enter the value of 2nd coord');
t = linspace(0,1);
xa = x1(1)+ (y1(1)-x1(1))*t;
ya = y1(1) + (y1(2)-x1(2))*t;
[x2] = input('Enter the value of 1st coord');
[y2] = input('Enter the value of 1st coord');
u = linspace(0,1);
xb = x2(1)+ (y2(1)-x2(1))*u;
yb = y2(1) + (y2(2)-x2(2))*u;
[x3] = input('Enter the value of 1st coord');
[y3] = input('Enter the value of 1st coord');
v = linspace(0,1);
xc = x3(1)+(y3(1)-x3(1))*v;
yc = y3(1)+(y3(2)-x3(2))*v;
plot(xa,ya,xb,yb,xc,yc);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by