how can I draw a line knowing just the midpoint and the angle?
2 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Hugo
2015-3-17
You can do this
midpoint=[a,b]; % This defines the midpoint. You should give a and b some value. lineangle=c; % This defines the angle. Use this if your angle is in radians. lineangle=c*pi/180; % This defines the angle. Use this if your angle is in degrees.
L=1; % This defines the length of the line
x=[-.5,.5]*L*cos(angle)+midpoint(1); y=[-.5,.5]*L*sin(angle)+midpoint(2); plot(x,y);
That's all
Hope this helps.
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!