I want to draw an arc (given its centre and its radius) between two elements.
For example the case given in the image below. I would like to draw an arc (of radius 0.5 (as an example) and the centre de point P drawed) strictly between those two lines
What is the general case of doing it? I mean, in this particular case there are two lines, but I would like a method that would work for whatever elements between I'd want to draw an arc (between a circle and a line, between two circles...etc).

댓글 수: 2

KSSV
KSSV 2020년 10월 22일
You have not commented on your previous question...
If the answer worked for you..you have to acknowledge the users who have helped you. With out closing that question, you are asking another question similiar ti it?
sorry, my fault

댓글을 달려면 로그인하십시오.

 채택된 답변

KSSV
KSSV 2020년 10월 22일

0 개 추천

L1=[1 3;
1 6]
L2=[-2 2;
8 -1]
P=InterX(L1,L2);
L = [L2(:,1) P L1(:,2)] ;
p = polyfit(L(1,:),L(2,:),2) ;
xi = linspace(min(L(1,:)),max(L(1,:))) ;
yi = polyval(p,xi) ;
figure
hold on
plot(L1(1,:),L1(2,:),'r')
plot(L2(1,:),L2(2,:),'b')
plot(P(1),P(2),'ro')
plot(xi,yi,'k')

댓글 수: 7

ErikJon Pérez Mardaras
ErikJon Pérez Mardaras 2020년 10월 22일
편집: ErikJon Pérez Mardaras 2020년 10월 22일
The arc I`m looking for is that one in green:
Okay...get the angles...th1 and th2.
th = linspace(th1,th2);
xc = r*cos(th) ;
yc = r*sin(th) ;
You can use slope formula to get angles.
I tried it out in a blank grpah just to try. th1 and th2 are 90º. I tried that code and it didn`t work
The code I entered was that:
axis equal
hold on
th = linspace(0,90);
xc = 0.5*cos(th) ;
yc = 0.5*sin(th) ;
plot(xc,yc,'r')
Your th is in degrees.....
th = linspace(0,pi/2);
xc = 0.5*cos(th) ;
yc = 0.5*sin(th) ;
plot(xc,yc,'r')
Thanks! I didn't realised. However, how do you stablish the centre of the arc? In the example given, the arc is drawn with a 0.5 radius, from 0º to 90º. But the centre is the 0.
How can I make the centre to be, for example, the coordinate 2,10? or the intersec point of two lines?
xc = 2+0.5*cos(Th) ;
yc = 10+0.5*sin(th) ;
thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

제품

릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by