Generate a triangle from a set of specified set variables.
이전 댓글 표시
I need to generate a triangle that will be able to be user controlled with input length of base in pixels and both base angles in degrees.
subplot(2,4,3);
sides = 3;
t = (1/(2*sides):1/(sides):1)*2*pi-pi/3;
x_size=100;
x = x_size*sin(t);
y = x_size*cos(t);
fill(x,y,'black');
axis square;
this is the code I used.
채택된 답변
추가 답변 (1개)
Image Analyst
2015년 5월 10일
0 개 추천
Why don't you have a user interface where you let the user control the width with a slider? See this framework. http://www.mathworks.com/matlabcentral/fileexchange/24224-magic-matlab-generic-imaging-component Put your code in the slider callback. First get the slider value, then use it in the rest of your code that draws the triangle.
카테고리
도움말 센터 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!