Info

此问题已关闭。 请重新打开它进行编辑或回答。

Calculate endpoint of user input line

1 次查看(过去 30 天)
Aarav Shah
Aarav Shah 2019-11-29
关闭: Walter Roberson 2020-1-25
while nAttempts>0 && stopLaser==false
[xClic,yClic]=ginput(1);
while yClic>=10 || yClic<=0
title('Stay within the boundary')
[xClic,yClic]=ginput(1);
end
%Keep data on board
hold on
xyValues = dlmread('Batman.txt');
xsLogo = xyValues(:,1);
ysLogo = xyValues(:,2);
%BatBeam
launchBeam = plot(xClic + xsLogo,yClic + ysLogo,'k');
hText = text(xClic,yClic,'BatBeam');
title('Alright, your laser is gonna fire now');
% Plot that point
plot(xClic, yClic)
xlim([0,100])
ylim([0,100])
hold on
% Compute y intercept for slope of 1
b = yClic+1*xClic;
% Plot the line between the click point and the y intercept
batBeam = plot([xClic,0],[yClic,b],'b-');
How would I calculate the endpoint of this line produced by this code that I made

回答(0 个)

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by